2011-04-22 14 views
0
#import "PantryLocator.h" 
#import "RootViewController.h" 
#import "CustomView.h" 
#import "PantriesViewController.h" 
#import "LafoodbankAppDelegate.h" 

@implementation PantryLocator 

@synthesize mymapView , activityIndicator , indexRow , cityName , customButton; 

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 
- (void)viewDidLoad 
{ 
    [self setCityName]; 
    [super viewDidLoad]; 
} 

-(void)setCityName 
{ 
    app5 = (LafoodbankAppDelegate *)[[UIApplication sharedApplication] delegate]; 

    pantryDetail = [app5.cities objectAtIndex:indexRow]; 

    cityName.frame = CGRectMake(80, 240, 150, 15); 

    [cityName setTitle:pantryDetail.cityName forState:UIControlStateNormal]; 


    //[self setCustomButton]; 
} 

/*-(void)setCustomButton 
{ 
    //To set custom button 
    customButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
    [customButton setImage:[UIImage imageNamed:@"go-button-green.png"] forState:UIControlStateNormal]; 
    [customButton addTarget:self action:@selector(goOnPantriesViewController:) forControlEvents:UIControlEventTouchUpInside]; 
    [customButton setFrame:CGRectMake(272, 239, 20, 21)]; 
    [self.view addSubview:customButton]; 
}*/ 

-(BOOL)textFieldShouldReturn:(UITextField *)textField 
{ 
    [textField resignFirstResponder]; 
    [textField release]; 
    return YES; 
} 

-(IBAction)backHome:(id)sender 
{ 
    [self.navigationController popViewControllerAnimated:YES]; 
} 

-(IBAction)selectCity:(id)sender 
{ 

    UIActionSheet *actionSheet = [[UIActionSheet alloc] init]; 
    [actionSheet showInView:self.view]; 
    actionSheet.frame = CGRectMake(0,225,320,200); 
    actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent; 

    CustomView *myView = [[CustomView alloc]initWithNibName:@"CustomView" bundle:nil]; 
    [actionSheet addSubview:myView.view]; 
    [actionSheet release]; 

    //myView.view.frame = CGRectMake(0, 0, 320,100); 
    //[myView release]; 
    /*UIPickerView *pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0, 40, 0, 0)]; 
    pickerView.showsSelectionIndicator = YES; 
    pickerView.delegate = self; 
    pickerView.dataSource = self; 

    [actionSheet addSubview:pickerView]; 
    [pickerView release]; 

    [actionSheet showInView:self.view]; 
    [actionSheet setBounds:CGRectMake(0, 0, 320, 485)]; 
    //[actionSheet release];*/ 
} 

-(IBAction)parsingCity:(id)sender 
{ 
    //Reading file from URL 
    NSURL *url = [[NSURL alloc]initWithString:@"http://www.lafoodbank.org/pantry-xml.aspx?city=all"]; 
    NSData *data = [[NSData alloc]initWithContentsOfURL:url]; 

    //Parsing 
    parser = [[PantryParser alloc]init]; 
    [parser parseXML:data]; 
    [data release]; 
} 

-(IBAction)goOnPantriesViewController:(id)sender 
{ 
    PantriesViewController *pantriesViewController = [[PantriesViewController alloc]initWithNibName:@"PantriesViewController" bundle:nil]; 
    [self.navigationController pushViewController:pantriesViewController animated:YES]; 
    [pantriesViewController release]; 
} 

-(IBAction)goToDesignsite:(id)sender 
{ 
    DesignWebView *designWebView = [[DesignWebView alloc]initWithNibName:@"DesignWebView" bundle:[NSBundle mainBundle]]; 
    [self.navigationController pushViewController:designWebView animated:YES]; 
    [designWebView release]; 
} 

- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
} 

- (void)viewDidUnload 
{ 
    [super viewDidUnload]; 
} 

- (void)dealloc 
{ 
    [super dealloc]; 
} 

@end 

在上面的代碼去我很困惑,我不是去下一個視圖時,我選擇setCityName特定城市選擇指數不顯示我的下一個視圖所以請給我的解決方案.....當我的tableview及後,我想在接下來的視圖

+0

u能具體描述一下您的問題?所以我可以給你更合適的解決方案.... – SJS 2011-04-22 10:33:12

回答

0

而不是

UIActionSheet *actionSheet = [[UIActionSheet alloc] init]; 

嘗試。

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Your Title" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; 

希望它有幫助。

-1

喜的朋友 轉到您的筆尖文件,並添加方法,以您的按鈕第一

相關問題