0
はい、問題がありますuitableviewcontrollerから継承するコントローラを作成しましたが、ツールバーのbarbutton項目のアクションシートを呼び出すコードを記述しましたが、エラーが表示されます。バーボタンの項目でアクションシートを呼び出す方法
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。 - アビシェーク8時59分
xibに正しく接続されています。 – Rocky