知识点小记
<#object#> 可以讓object進(jìn)入預(yù)選狀態(tài)
調(diào)用set/get方法一定要用self.不要用_ 這幾天吃了好多虧
打包的時候要記著把DEBUG改為release
[[NSNotificationCenter defaultCenter] postNotificationName:@"PushToTuCaoWebView" object:nil];使用通知在object類進(jìn)行鋪設(shè)跳轉(zhuǎn)
RAC學(xué)習(xí):
1.使用RAC監(jiān)控textFiled文本輸入,包括點擊
[[filed rac_textSignal] subscribeNext:^(id x) {
NSLog(@"=========%@",x);
}];
2.監(jiān)聽一個繼承View視圖控件的手勢動作
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
[[tap rac_gestureSignal] subscribeNext:^(id x) {
NSLog(@"tap");
}];
[self.view addGestureRecognizer:tap];
3.通知
發(fā)送通知和數(shù)據(jù):NSMutableArray *dataArray = [[NSMutableArray alloc] initWithObjects:@"1", @"2", @"3", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"postData" object:dataArray];
接收數(shù)據(jù):[[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"postData" object:nil] subscribeNext:^(NSNotification *notification) {
NSLog(@"%@", notification.object);??? //object即為數(shù)組的參數(shù)
}];
4.KVO監(jiān)聽scrollView的滾動
RACObserve(TARGET, KEYPATH)中TARGET是監(jiān)聽目標(biāo),KEYPATH是要觀察的屬性值
每當(dāng)scrolView的contentOffset發(fā)生變化時,就會被監(jiān)聽到
//=====================================================
當(dāng)項目里面TabBar嵌套Nav時,進(jìn)行Push的時候隱藏TabBar的問題。hidesBottomBarWhenPushed這個方法。如果為YES,當(dāng)這個控制器push的時候,底部的Bar,比如Tabbar會滑走,也就是不會在push后的視圖上顯示出來,默認(rèn)值為NO。
做一個漸變色的背景(uicolor的拓展類)
+ (CAGradientLayer *)setGradualChangingColor:(UIView *)view fromColor:(NSString *)fromHexColorStr toColor:(NSString *)toHexColorStr{
//? ? CAGradientLayer類對其繪制漸變背景顏色、填充層的形狀(包括圓角)
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = view.bounds;
//? 創(chuàng)建漸變色數(shù)組,需要轉(zhuǎn)換為CGColor顏色
gradientLayer.colors = @[(__bridge id)[UIColor colorWithHexString:fromHexColorStr].CGColor,(__bridge id)[UIColor colorWithHexString:toHexColorStr].CGColor];
//? 設(shè)置漸變顏色方向,左上點為(0,0), 右下點為(1,1)
gradientLayer.startPoint = CGPointMake(0, 0);
gradientLayer.endPoint = CGPointMake(1, 1);
//? 設(shè)置顏色變化點,取值范圍 0.0~1.0
gradientLayer.locations = @[@0,@1];
return gradientLayer;
}
在VC里調(diào)用下:
UIView *sysView = [UIView new];
[sysView setFrame:CGRectMake(60, 60, 100, 40)];
sysView.layer.cornerRadius = 20.0;
sysView.layer.masksToBounds = YES;
[sysView.layer addSublayer:[UIColor setGradualChangingColor:sysView fromColor:@"F76B1C" toColor:@"FBDA61"]];
[self.view addSubview:sysView];
二。。。Xcode同時打開兩個Simulator模擬器(做通信APP方便調(diào)試)
方法一:打開終端進(jìn)到xcode路徑下的Applications路徑
$:cd /Applications/Xcode.app/Contents/Developer/Applications/
打開模擬器
$:open -n Simulator.app/
方法二:或者執(zhí)行一個腳本也可以,創(chuàng)建文件xim.sh,鍵入以下代碼
1.#!/bin/sh
2.cd /Applications/Xcode.app/Contents/Developer/Applications/
3.open -n Simulator.app/
4.sudo sh sim.sh
三,[父控件.viewlayoutIfNeeded];的使用
總結(jié)
- 上一篇: 暴力摩托2008游戏打不开玩不了解决方法
- 下一篇: 绝对定位多个字居中显示的css