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