iOS中如何实现UIActionSheet动态添加按钮-古蔺大橙子建站
RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
iOS中如何实现UIActionSheet动态添加按钮

这篇文章主要介绍iOS中如何实现UIActionSheet动态添加按钮,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

创新互联建站自2013年创立以来,是专业互联网技术服务公司,拥有项目网站设计制作、网站设计网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元雁塔做网站,已为上家服务,为雁塔各地企业和个人服务,联系电话:18980820575

一,效果图。

iOS中如何实现UIActionSheet动态添加按钮

二,代码。

RootViewController.h

#import 
@interface RootViewController : UIViewController

@end

RootViewController.m

//点击任何处,弹出UIActionSheet
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
  UIActionSheet *sheet=[[UIActionSheet alloc]initWithTitle:@"标题" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil, nil];
  // 逐个添加按钮(比如可以是数组循环)
  [sheet addButtonWithTitle:@"Item A"];
  [sheet addButtonWithTitle:@"Item B"];
  [sheet addButtonWithTitle:@"Item C"];
  // 同时添加一个取消按钮
  [sheet addButtonWithTitle:@"Cancel"];
  sheet.cancelButtonIndex = sheet.numberOfButtons-1;
  [sheet showInView:self.view];
}

以上是“iOS中如何实现UIActionSheet动态添加按钮”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


当前文章:iOS中如何实现UIActionSheet动态添加按钮
网页网址:http://scgulin.cn/article/gghohg.html