您的位置:首页 > 产品设计 > UI/UE

UIActinSheet和UIActionSheetDelegate

2016-07-18 11:05 495 查看

UIActinSheet和UIActionSheetDelegate





这个是就那个UIActionSheet对象 一般用来选择类型或者改变界面。。。还有更多应用

定义如下:
UIActionSheet *styleAlert = [[UIActionSheet alloc] initWithTitle:@"Choose a UIBarStyle:"
delegate:self cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles: @"Default",
@"BlackOpaque",
@"BlackTranslucent",
nil,
nil];

// use the same style as the nav bar
styleAlert.actionSheetStyle = self.navigationController.navigationBar.barStyle;
//styleAlert.actionSheetStyle =UIActionSheetStyleAutomatic;
[styleAlert showInView:self.view];
[styleAlert release];

在委托里的操作代码如下:
- (void)actionSheet:(UIActionSheet *)modalView clickedButtonAtIndex:(NSInteger)buttonIndex
{
// Change the navigation bar style, also make the status bar match with it
switch (buttonIndex)
{
case 0:
{
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
break;
}
case 1:
{
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
break;
}
case 2:
{
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
break;
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: