标签:name ref navig frame sys 字体 fork end 返回手势
-(void)viewDidLayoutSubviews {
if ([self.tableview respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableview setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableview respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableview setLayoutMargins:UIEdgeInsetsZero];
}
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPat{
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setSeparatorInset:)]){
[cell setSeparatorInset:UIEdgeInsetsZero];
}
}
tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
另外一个枚举为UIScrollViewKeyboardDismissModeInteractive,表示在键盘内部滑动,键盘逐渐下去。
navigationController.hidesBarsOnSwipe = Yes;
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
[textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
[textField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];
UIViewController *vc = [UIViewController new];
vc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:vc animated:YES];
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
AFURLResponseSerialization.m
self.acceptableContentTypes = [NSSetsetWithObjects:@"application/json", @"text/html",@"text/json",@"text/javascript", nil];
//隐藏头部左边的返回
self.navigationItem.hidesBackButton=YES;
//方法一
NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
//方法二
- (void)resetDefaults {
NSUserDefaults * defs = [NSUserDefaults standardUserDefaults];
NSDictionary * dict = [defs dictionaryRepresentation];
for (id key in dict) {
[defs removeObjectForKey:key];
}
[defs synchronize];
}
? %@ 对象
? %d, %i 整数
? %u 无符整形
? %f 浮点/双字
? %x, %X 二进制整数
? %o 八进制整数
? %zu size_t
? %p 指针
? %e 浮点/双字 (科学计算)
? %g 浮点/双字
? %s C 字符串
? %.*s Pascal字符串
? %c 字符
? %C unichar
? %lld 64位长整数(long long)
? %llu 无符64位长整数
? %Lf 64位双字
#define SINGLE_LINE_WIDTH (1 / [UIScreen mainScreen].s 大专栏 知识整理cale)
#define SINGLE_LINE_ADJUST_OFFSET ((1 / [UIScreen mainScreen].scale) / 2)
UIView *view = [[UIView alloc] initWithFrame:CGrect(x - SINGLE_LINE_ADJUST_OFFSET, 0, SINGLE_LINE_WIDTH, 100)];
//-Wdeprecated-declarations 编译器警告的类型
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#pragma clang diagnostic pop
if (CGAffineTransformIsIdentity(self.view.transform))
{//还原形变
self.view.transform = CGAffineTransformIdentity;
}
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update
self.collectionViewH = self.flowLayout.collectionViewContentSize.height;
NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if([[UIApplication sharedApplication] canOpenURL:url]) {
NSURL*url =[NSURL
URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:url];
}
NSString *str = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=xxxxxx" ];
if( ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0)){
str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/idxxxxxxx"];
}
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
// 1.创建dispatch_group_t
dispatch_group_t group = dispatch_group_create();
for (int i=0; i<10; i++) {
// 2、将当前的下载操作添加到组中
dispatch_group_enter(group);
{
// 数据请求成功离开当前组
dispatch_group_leave(group);
}
}
// 3.当所有图片都下载完毕再通过闭包通知调用者
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
// 能够来到这个地方, 一定是所有任务都已经完成
});
UILabel *originPriceLabel = [UILabel new];
NSString *originPriceString = [NSString stringWithFormat:@"¥ %@0", @"100"];
NSMutableAttributedString *originPriceAttrsStr = [[NSMutableAttributedString alloc] initWithString:originPriceString];
[originPriceAttrsStr addAttribute:NSStrikethroughStyleAttributeName value:@(1)
range:NSMakeRange(0, originPriceString.length)];
originPriceLabel.attributedText = originPriceAttrsStr;
UILabel *label = [UILabel new];
label.numberOfLines = 0;
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 4;
NSDictionary *attributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:14], NSParagraphStyleAttributeName:paragraphStyle};
label.attributedText = [[NSAttributedString alloc]initWithString:label.text attributes:attributes];
// 只需要加上这段代码就可以去除锯齿
imageView.layer.shouldRasterize = YES;
当shouldRasterize设成true时,layer被渲染成一个bitmap,并缓存起来,等下次使用时不会再重新去渲染了。实现圆角本身就是在做颜色混合(blending),如果每次页面出来时都blending,消耗太大,这时shouldRasterize = yes,下次就只是简单的从渲染引擎的cache里读取那张bitmap,节约系统资源。
额外收获:如果在滚动tableView时,每次都执行圆角设置,肯定会阻塞UI,设置这个将会使滑动更加流畅。
原文链接:http://blog.csdn.net/zhuangyou123/article/details/8737367
标签:name ref navig frame sys 字体 fork end 返回手势
原文地址:https://www.cnblogs.com/lijianming180/p/12433383.html