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