腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
首页
标签
popover
#
popover
关注
专栏文章
(16)
技术视频
(0)
互动问答
(1)
UIPopover如何用这样的按钮制作一个popover ?
2
回答
popover
、
对象
工口Miku
说唱歌手
类似于其他的回应,但这是很容易实现的比较。 使您的类使用UIActionSheetDelegate。 例子: @interface ExampleViewController : UIViewController <UIActionSheetDelegate> 然后添加到ExampleViewController.mm/m中 - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { //Get the name of the current pressed button NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex]; if ([buttonTitle isEqualToString:@"Remove"]) { NSLog(@"Remove this actionSheet"); } if ([buttonTitle isEqualToString:@"Button 1"]) { NSLog(@"Button 1 pressed"); } if ([buttonTitle isEqualToString:@"Button 2"]) { NSLog(@"Button 2 pressed"); } if ([buttonTitle isEqualToString:@"Button 3"]) { NSLog(@"Button 3 pressed"); } if ([buttonTitle isEqualToString:@"Cancel"]) { NSLog(@"Cancel clicked (anywhere away from it)"); } } 现在,在按钮按下的事件中,或者在需要弹出事件的位置/时间,请调用以下命令: - (IBAction)aButtonPressed:(id)sender { NSString *actionSheetTitle = @"Action Sheet"; // Title NSString *destroyTitle = @"Destroy"; // Button titles NSString *button1 = @"Button 1"; NSString *button2 = @"Button 2"; NSString *button3 = @"Button 3"; NSString *cancelTitle = @"Cancel"; UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:actionSheetTitle delegate:self cancelButtonTitle:cancelTitle destructiveButtonTitle:destroyTitle otherButtonTitles:button1, button2, button3, nil]; [actionSheet showInView:self.view]; } 更多有关这方面的信息:http://developer.apple.com/library/ios/#documentation/uikit/reference/UIActionSheet_Class/Reference/Reference.html ...
展开详请
赞
0
收藏
0
评论
0
分享
类似于其他的回应,但这是很容易实现的比较。 使您的类使用UIActionSheetDelegate。 例子: @interface ExampleViewController : UIViewController <UIActionSheetDelegate> 然后添加到ExampleViewController.mm/m中 - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { //Get the name of the current pressed button NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex]; if ([buttonTitle isEqualToString:@"Remove"]) { NSLog(@"Remove this actionSheet"); } if ([buttonTitle isEqualToString:@"Button 1"]) { NSLog(@"Button 1 pressed"); } if ([buttonTitle isEqualToString:@"Button 2"]) { NSLog(@"Button 2 pressed"); } if ([buttonTitle isEqualToString:@"Button 3"]) { NSLog(@"Button 3 pressed"); } if ([buttonTitle isEqualToString:@"Cancel"]) { NSLog(@"Cancel clicked (anywhere away from it)"); } } 现在,在按钮按下的事件中,或者在需要弹出事件的位置/时间,请调用以下命令: - (IBAction)aButtonPressed:(id)sender { NSString *actionSheetTitle = @"Action Sheet"; // Title NSString *destroyTitle = @"Destroy"; // Button titles NSString *button1 = @"Button 1"; NSString *button2 = @"Button 2"; NSString *button3 = @"Button 3"; NSString *cancelTitle = @"Cancel"; UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:actionSheetTitle delegate:self cancelButtonTitle:cancelTitle destructiveButtonTitle:destroyTitle otherButtonTitles:button1, button2, button3, nil]; [actionSheet showInView:self.view]; } 更多有关这方面的信息:http://developer.apple.com/library/ios/#documentation/uikit/reference/UIActionSheet_Class/Reference/Reference.html
热门
专栏
Android知识点总结
592 文章
66 订阅
跟牛老师一起学WEBGIS
426 文章
111 订阅
acoolgiser_zhuanlan
156 文章
25 订阅
java 微风
397 文章
32 订阅
code秘密花园
580 文章
63 订阅
领券