0
是的,但我有一個問題,我已經創建了一個控制器,從uitableviewcontroller繼承,我寫了一個代碼,調用工具欄上的barbutton項目的操作表,但它給了我一個錯誤。如何調用酒吧按鈕項目上的actionsheet
mapType = [[[UIBarButtonItem alloc]initWithTitle:@"MAP TYPE" style:UIBarButtonItemStyleBordered target:self action:@selector(chooseMapType:)]autorelease];
self.toolbarItems = [NSArray arrayWithObjects:space, addButton, removeButton,mapType, nil]; [self.navigationController.view addSubview:self.navigationController.toolbar];
- (IBAction)chooseMapType:(id)sender {
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Map Type" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:kMapTypeRegular, kMapTypeSatellite, nil];
[sheet showFromToolbar:navigationController.toolbar];
[sheet release];
}
這是我的方法,我已經傳遞給我的選擇器。
- (void)actionSheet:(UIActionSheet*)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *clickedButtonTitle = [actionSheet buttonTitleAtIndex:buttonIndex];
if ([clickedButtonTitle isEqualToString:kMapTypeRegular])
[[self mapView] setMapType:MKMapTypeStandard];
else if ([clickedButtonTitle isEqualToString:kMapTypeSatellite])
[[self mapView] setMapType:MKMapTypeSatellite];
}
這個我我的動作片的方法,但它是沒有得到調用,並給我一個錯誤 - [UIActionSheet _presentSheetFromView:上面:],/SourceCache/UIKit_Sim/UIKit-1447.6.4/UIActionSheet。 - 阿布舍克3月24日在8:59
它正確連接到xib – Rocky 2011-03-28 06:15:42