无题

dispatch_after:延时操作

//下面可以让前面数组中对象,都执行后面的方法
[self.selectBtns makeObjectsPerformSelector:@selector(setSelected:) withObject:@(NO)];

/* Return true if point' is contained inrect', false otherwise. */
bool CGRectContainsPoint(CGRect rect, CGPoint point)

//UITextField设置搜索图标


UITextField *searBar = [[UITextField alloc]init]; //背景 searBar.background = [UIImage resizeImageWithName:@"searchbar_textfield_background"]; //尺寸 searBar.frame = CGRectMake(0, 0, 300, 30); //左边,搜索图标 UIImageView *iconView = [[UIImageView alloc]initWithImage:[UIImage imageWithName:@"searchbar_textfield_search_icon"]]; iconView.contentMode = UIViewContentModeCenter; iconView.frame = CGRectMake(0, 0, 30, 30); searBar.leftView =iconView ; searBar.leftViewMode = UITextFieldViewModeAlways;//左边的view永远显示 //字体 searBar.font = [UIFont systemFontOfSize:13]; //文本框右边的删除按钮 searBar.clearButtonMode = UITextFieldViewModeAlways; // searBar.placeholder = @"搜索..."; //设置提醒文字 NSMutableDictionary *arrts = [NSMutableDictionary dictionary];//文本框中隐藏的搜索按钮 arrts[NSForegroundColorAttributeName] = [UIColor grayColor]; searBar.attributedPlaceholder = [[NSAttributedString alloc]initWithString:@"搜索..." attributes:arrts];
self.navigationItem.titleView = searBar;

// 设置键盘右下角按钮的样式
self.returnKeyType = UIReturnKeySearch;
self.enablesReturnKeyAutomatically = YES;

//高亮的时候,不要调整图标
titleButton.adjustsImageWhenHighlighted = NO;

四舍五入
int pageInt = (int)(page + 0.5);;

按钮属性
checkBox.contentEdgeInsets = UIEdgeInsetsMake(10, 10, 10, 10);//内边距,按钮内部四周的间距 checkBox.titleEdgeInsets = UIEdgeInsetsMake(10, 10, 10, 10);
checkBox.imageEdgeInsets = UIEdgeInsetsMake(10, 10, 10, 10);

//请求url的绝对路径
NSString *urlStr = request.URL.absoluteString;
urlStr rangeOfString:@"code=")//包含

//如果服务器返回的数字很大,就用long long ,比如说主键

KVC:会吧字典所有的key-value赋值给对应的属性。

 //taleivew的黑色分割线,cell分割线去掉    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

//去掉cell的背景色 self.backgroundColor = [UIColor clearColor];

05-19:
<04-发微博04-自定义toolbar.mp4>:15:00修改项目名称

//定时检查未读数 // [self checkUnReadCount];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(checkUnReadCount) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

/** * 当一个对象从xib或者storyboard中加载完毕后,就会调用一次 ///- (void)awakeFromNib//{// NSLog(@"awakeFromNib");//// self.titleFont = [UIFont systemFontOfSize:14];//}/* * 从文件中解析一个对象的时候就会调用这个方法 /- (id)initWithCoder:(NSCoder )decoder{ if (self = [super initWithCoder:decoder]) { [self setup]; } return self;}/ * 通过代码创建控件的时候就会调用 /- (id)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self setup]; } return self;}/* * 初始化 */- (void)setup{ self.titleFont = [UIFont systemFontOfSize:14]; self.titleLabel.font = self.titleFont; // 图标居中 self.imageView.contentMode = UIViewContentModeCenter;
}
设置子控件的frame用: -(void)layoutSubviews

有时候按钮长按变灰,而不是我们设置的高亮图片,是由于type设置为system不实,custom

/** * 系统第一次使用这个类的时调用,1个类只调用一次。 */
+(void)initialize

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • iOS开发系列--网络开发 概览 大部分应用程序都或多或少会牵扯到网络开发,例如说新浪微博、微信等,这些应用本身可...
    lichengjin阅读 3,705评论 2 7
  • *7月8日上午 N:Block :跟一个函数块差不多,会对里面所有的内容的引用计数+1,想要解决就用__block...
    炙冰阅读 2,515评论 1 14
  • 概述在iOS开发中UITableView可以说是使用最广泛的控件,我们平时使用的软件中到处都可以看到它的影子,类似...
    liudhkk阅读 9,085评论 3 38
  • 1,Search Bar 怎样去掉背景的颜色(storyboard里只能设置background颜色,可是发现cl...
    以德扶人阅读 2,426评论 2 50
  • 内心住着孩子,看到的世界总会更美好!愿我们的内心天使常在!
    remember_me阅读 196评论 0 1