摘要: NSString *string = @" spaces in front and at the end ";NSString *trimmedString = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAnd... 阅读全文
posted @ 2015-11-12 10:31 罕见 阅读(462) 评论(0) 推荐(0) 编辑
摘要: 今天看到一篇关于iOS应用性能优化的文章,其中提到计算代码的运行时间,觉得非常有用,值得收藏。不过在模拟器和真机上是有差异的,以此方法观察程序运行状态,提高效率。第一种:(最简单的NSDate)NSDate* tmpStartData = [NSDate date];//You code here.... 阅读全文
posted @ 2015-10-10 11:51 罕见 阅读(847) 评论(0) 推荐(0) 编辑
摘要: id object = [self nextResponder]; while (![object isKindOfClass:[UIViewController class]] &&object != nil) { object = [object nextResponder]; } ... 阅读全文
posted @ 2015-07-30 14:08 罕见 阅读(266) 评论(0) 推荐(0) 编辑
摘要: [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; 阅读全文
posted @ 2015-07-08 11:51 罕见 阅读(1071) 评论(0) 推荐(0) 编辑
摘要: 1,UIView的setNeedsDisplay和setNeedsLayout方法首先两个方法都是异步执行的。而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到 UIGraphicsGetCurrentContext,就可以画画了。而setNeedsLayout会默认调... 阅读全文
posted @ 2015-06-04 10:49 罕见 阅读(112) 评论(0) 推荐(0) 编辑
摘要: CGSize size = [self.username.text boundingRectWithSize:(CGSize){130,20} options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName... 阅读全文
posted @ 2015-06-01 16:57 罕见 阅读(183) 评论(0) 推荐(0) 编辑
摘要: NSDateFormatter *dateFormtter=[[NSDateFormatter alloc] init]; [dateFormtter setDateFormat:@"yyyy-MM-dd"]; NSString *dateString=[dateFormtter string... 阅读全文
posted @ 2015-05-27 16:18 罕见 阅读(124) 评论(0) 推荐(0) 编辑
摘要: NSString *urlPath = [[NSBundle mainBundle] pathForResource:@"" ofType:@""];NSURL *url = [NSURL fileURLWithPath:urlPath];self.player = [[AVAudioPlayer ... 阅读全文
posted @ 2015-05-25 15:18 罕见 阅读(135) 评论(0) 推荐(0) 编辑
摘要: [_postNewTopicBtn.imageView.layer setCornerRadius:20];[_postNewTopicBtn.imageView.layer setMasksToBounds:YES]; 阅读全文
posted @ 2015-05-21 18:11 罕见 阅读(135) 评论(0) 推荐(0) 编辑
摘要: - (id)readViewControllerFromStoryBoardWithIdentifier:(NSString *)identifier{ return [[UIStoryboard storyboardWithName:@"ELVStoryBoard" bundle:nil] in... 阅读全文
posted @ 2015-05-15 17:37 罕见 阅读(397) 评论(0) 推荐(0) 编辑