摘要:
其实问题的本质原因是button在移动之后一直处于按下的状态.导致无法触发方法.我们要做的就是在移动后取消button的按下状态.以下为MyButton的.m文件.我的自定义button模仿了苹果的虚拟home键.拖拽后有自动向左或者向右(根据坐标)的效果.@interface MyButton : UIButton{ CGPoint beginPoint;}@property(nonatomic) BOOL dragEnable;@end以下为.m文件#import "MyButton.h"@implementation MyButton- (id)initWithFra 阅读全文
摘要:
//此处为动态菊花动画 UIActivityIndicatorView *tableFootActivityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(75.0f, 10.0f, 20.0f, 20.0f)]; [tableFootActivityIndicatorView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge]; [tableFootActivityIndicatorView startAn 阅读全文
摘要:
UIPickerView控件在给用户选择某些特定的数据时经常使用到,这里演示一个简单的选择数据,显示在UITextField输入框里,把UIPickerView作为输入View,用Toolbar作为选定数据的按钮。和其他UITableView控件相似,UIPickerView也需要数据源。我们要实现的效果如下:下面开始使用的步骤。1、打开XCode 4.3.2,新建一个Single View Application ,命名为PickerViewDemo,Company Identifier 为:com.rongfzh.yc2、拖放控件2.1、拖放一个UIPickerView,放置在View的最 阅读全文
摘要:
//创建一个button,添加在控制器视图UIButton *addButton = [UIButton buttonWithType:UIButtonTypeContactAdd]; addButton.backgroundColor = [UIColor clearColor]; addButton.frame = CGRectMake(0, 440, 40, 40); [addButton addTarget:self action:@selector(add:) forControlEvents:UIControlEventTouchUpInside]; [self.view addS 阅读全文
摘要:
-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{FirstViewController*firstViewController=[[FirstViewControlleralloc]initWithNibName:@"FirstViewController"bundle:nil];UINavigationController*navControl1=[[UINavigationControlleralloc]ini 阅读全文
摘要:
scrollView的几个属性contentSize contentOffset contentInsetcontentSize是scrollview可以滚动的区域,比如frame = (0 ,0 ,320 ,480) contentSize = (320 ,960),代表你的scrollview可以上下滚动,滚动区域为frame大小的两倍。contentOffset是scrollview当前显示区域顶点相对于frame顶点的偏移量,比如上个例子你拉到最下面,contentoffset就是(0 ,480),也就是y偏移了480contentInset是scrollview的contentvie 阅读全文