所以我在类的名称上完全画了一个空白,该类使用多个选项绘制这些模式提示之一。我附上了截图。这是确认用户是否要退出的提示。
问问题
345 次
4 回答
3
那是一个UIActionSheet
,阅读UIActionSheet 类参考。
例子
在您的标头中,您需要添加<UIActionSheetDelegate>
协议。然后在你的@implementation
这就是你如何调用这个特定的工作表:
UIActionSheet * sampleSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure you'd like to sign out from Path?" delegate:self
cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Sign Out" otherButtonTitles:nil];
[sampleSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
[sampleSheet showInView:self.view];
这就是您处理工作表的方式:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch ( buttonIndex )
{
case 0:
NSLog(@"User Chose Cancel");
break;
case 1:
NSLog(@"User Chose to Sign out.");
break;
}
}
于 2012-05-04T18:18:43.250 回答
0
于 2012-05-04T18:20:27.517 回答
0
请参阅 UIActionSheet,我认为这就是您正在寻找的课程。
于 2012-05-04T18:21:31.200 回答
0
UIActionSheet *popupQuery;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
//give the user an option to choose an image from their library or take a new photo...
popupQuery = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Take Photo", @"Choose From Library", nil];
popupQuery.tag = 0;
}
else {
//give the user an option to choose an image from their library or take a new photo...
popupQuery = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Choose From Library", nil];
popupQuery.tag = 1;
}
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[popupQuery showInView:[self.view window]];
[popupQuery release];
于 2012-05-04T18:22:35.207 回答