摘要: 先说一下我的视图现在的结构控制器的view上添加有textView ,textField,点击弹出键盘后,点击视图的其他位置,让键盘回收.---------------------------------------------------------------------------------------------------------------------------------------------------------//在点击需要收回键盘的视图添加单击手势UITapGestureRecognizer *tap = [[UITapGestureRecognizer all 阅读全文
posted @ 2014-01-16 22:15 徐坤很无聊 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 这是UITextView的指定初始化方法.- (instancetype)initWithFrame:(CGRect)frame textContainer:(NSTextContainer *)textContainer但是在实际的使用过程中,我们一般只需要指定其Frame即可.初始化方法中第二个参数textContainer,这个是官方解释The text container to use for the receiver (can be nil).这个类未研究.但是看到可以设置为nil,也就是说在一定的条件下必须设置为非空.如下这种情况,在一个视图中创建一个UITextView的话,te 阅读全文
posted @ 2014-01-16 22:04 徐坤很无聊 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 其实问题的本质原因是button在移动之后一直处于按下的状态.导致无法触发方法.我们要做的就是在移动后取消button的按下状态.以下为MyButton的.m文件.我的自定义button模仿了苹果的虚拟home键.拖拽后有自动向左或者向右(根据坐标)的效果.@interface MyButton : UIButton{ CGPoint beginPoint;}@property(nonatomic) BOOL dragEnable;@end以下为.m文件#import "MyButton.h"@implementation MyButton- (id)initWithFra 阅读全文
posted @ 2014-01-15 18:00 徐坤很无聊 阅读(332) 评论(0) 推荐(0) 编辑
摘要: //此处为动态菊花动画 UIActivityIndicatorView *tableFootActivityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(75.0f, 10.0f, 20.0f, 20.0f)]; [tableFootActivityIndicatorView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge]; [tableFootActivityIndicatorView startAn 阅读全文
posted @ 2014-01-15 15:28 徐坤很无聊 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 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的最 阅读全文
posted @ 2014-01-15 10:11 徐坤很无聊 阅读(137) 评论(0) 推荐(0) 编辑
摘要: //创建一个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 阅读全文
posted @ 2014-01-15 10:06 徐坤很无聊 阅读(365) 评论(0) 推荐(0) 编辑
摘要: -(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{FirstViewController*firstViewController=[[FirstViewControlleralloc]initWithNibName:@"FirstViewController"bundle:nil];UINavigationController*navControl1=[[UINavigationControlleralloc]ini 阅读全文
posted @ 2014-01-15 08:45 徐坤很无聊 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2014-01-15 00:28 徐坤很无聊 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 今天在用到NSString类的时候遇到一个问题,挺费解的,问题是这样的:我从服务器上获取某字符串数据,考虑到有些对象不含这个字符串变量,我在使用时先判断该字符串是否为空,例如:假设,这个字符串名叫str,先判断if(str!=nil){//do somethingdouble data=[str doubleValue];}但是,当数据为空时依旧报错,错误内容如下:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull doubleValue]: 阅读全文
posted @ 2014-01-14 10:38 徐坤很无聊 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 下拉刷新:EGOTableViewPullRefresh 网络应用:ASIHTTPRequest 等待特效:MBProgressHUD JSON解释:json-framework --------------------- 纵向表格: https://github.com/danielctull/DTGridView/ http://www.cocoachina.com/bbs/simple/?t47282.html 扫描wifi信息: http://code.google.com/p/uwecaugmentedrealityproject/ http://code.google.com/p/ 阅读全文
posted @ 2014-01-13 19:48 徐坤很无聊 阅读(144) 评论(0) 推荐(0) 编辑