动态添加按钮
来源:互联网 发布:疯狂美工破解版 编辑:程序博客网 时间:2024/05/21 09:45
1.动态添加按钮
for (int i =0; i<self.arrayPin.count; i++) {
NSString *xnum = [[self.arrayPinobjectAtIndex:i] objectForKey:@"x"];
NSString *ynum = [[self.arrayPinobjectAtIndex:i] objectForKey:@"y"];
UIButton *button = [UIButtonbuttonWithType:UIButtonTypeCustom];
UIImage *buttonimage = [UIImageimageNamed:@"needle1"];
[buttonsetFrame:CGRectMake([xnumintValue]-buttonimage.size.width, [ynumintValue]- buttonimage.size.height, buttonimage.size.width, buttonimage.size.height)];
[button setImage:buttonimageforState:UIControlStateNormal];
[buttonsetTag: i+1];
[button addTarget:selfaction:@selector(action:)forControlEvents:UIControlEventTouchUpInside];
[buttonArrayaddObject:button];//按钮加到数组里
}
2.遍历动态添加的按钮
[buttonArrayenumerateObjectsUsingBlock:^(id obj,NSUInteger idx,BOOL *stop){
UIButton *button =obj;
[buttonsetHidden:YES];
}];
- gridview动态添加按钮
- UIActionSheet动态添加按钮
- Coolite动态添加按钮
- 动态添加按钮
- 添加动态按钮
- 动态添加UIActionSheet按钮
- 动态添加按钮
- iOS 动态添加按钮
- 动态添加UIActionSheet按钮
- 动态添加button按钮
- 动态添加发帖按钮
- 添加动态按钮(UIAlertButton)
- iOS开发:动态添加按钮
- IOS AlertView动态添加按钮
- MFC Ribbon 动态添加按钮
- iOS开发:动态添加按钮
- android_动态添加按钮和事件中添加按钮
- 给动态添加的按钮添加动态事件
- android4.0隐藏状态栏电池图标
- Android开发: Eclipse中导入项目前有红叉提示但是项目文件内容无错误的解决方法
- addTimeInterval Deprecated in iOS 4.0
- 联想ERP项目实施案例分析(3):业务蓝图定义与团队建设
- shell脚本语法
- 动态添加按钮
- malloc函数详解
- dedecms 栏目添加缩略图
- windows server2008(64位)系统上安装wamp后,Apache启动失败
- (java)仿百度文库方案
- cocos2d-x 3.0rc开发指南:Windows下Android环境搭建
- SequoiaDB:比MongoDB领先一到两年 打造企业级NoSQL数据库
- DB2中CAST的问题
- 对象的销毁原则