可以横向弹出的Button
来源:互联网 发布:淘宝欧时力有正品吗 编辑:程序博客网 时间:2024/06/07 19:31
控件例子:http://download.csdn.net/detail/qqmcy/6972517
ViewController.m使用方法如下:例子来自网上,出处忘记了。我在原版基础上加了,主Button的代理回调
//// ViewController.m// 可以横向弹出的Button//// Created by 杜甲 on 14-2-28.// Copyright (c) 2014年 杜甲. All rights reserved.//#import "ViewController.h"#import "OCExpandableButton.h"@interface ViewController ()<OCExpandableButtonAlignmentDelegate>@property (strong , nonatomic) OCExpandableButton* button;@end@implementation ViewController- (void)viewDidLoad{ [super viewDidLoad];// Do any additional setup after loading the view, typically from a nib. NSMutableArray *subviews = [[NSMutableArray alloc] init]; for(int i = 0; i < 2; i++) { UIButton *numberButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30.f, 30.f)]; numberButton.tag = i; numberButton.backgroundColor = [UIColor clearColor]; [numberButton setTitle:[NSString stringWithFormat:@"%d", i] forState:UIControlStateNormal]; numberButton.titleLabel.textAlignment = NSTextAlignmentCenter; [numberButton addTarget:self action:@selector(tapped:) forControlEvents:UIControlEventTouchUpInside]; [subviews addObject:numberButton]; } self.button = [[OCExpandableButton alloc] initWithFrame:CGRectMake(0, 57, 39, 59) subviews:subviews]; // button.backgroundColor = [UIColor redColor]; self.button.delegate = self; //You can change the alignment with: self.button.alignment = OCExpandableButtonAlignmentLeft; [self.view addSubview:self.button];}- (void)tapped:(UIButton*)sender { switch (sender.tag) { case 0: break; default: break; } [self.button close]; NSLog(@"tapped = %d",sender.tag);}-(void)mainButton:(BOOL)active{ }- (void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end
0 0
- 可以横向弹出的Button
- 可以横向滑动竖向滑动的listview
- 横向滑动可以删除的listView
- 可以纵向横向滑动的表格实现
- 横向弹出菜单
- Button按钮的使用和弹出对话框
- 弹出可以拖动的框
- div+css制作的水平三级横向弹出菜单
- 一个有趣的可以伸缩的button
- 超链接可以是button的样式
- 自定义控件 - 可以显示进度的Button
- 可以显示横向ScrollBar的下拉框ComboBox
- Android 写一个可以横向滑动条目的列表
- 【Android】用RecycleView实现可以横向滚动的ListView效果
- iOS 可以纵向横向滑动的表格实现
- CSS实现横向弹出菜单
- css 三级横向弹出菜单
- Android开发消除横向排列的多个Button之间的空隙
- 浙江大学pat 1007
- 一句话小计 initWithNibName
- 浙大 pat Basic Level 1001
- 利用反射访问私有属性、调用私有方法
- 为什么使用设计模式
- 可以横向弹出的Button
- PHP操作MySQL,insert字符串 无法执行的问题
- CSS总结
- matlab笔记1:我用的图像命令
- CoaoaChina开发者小测验常识题
- 继承与初始化和构造器的调用
- 大数乘以整形数nyoj 155
- NGUI 拖拽丢弃实现
- PHP的curl实现get,post 和 cookie(几个实例)