iOS開發基礎知識--片段31

來源:互聯網
上載者:User

標籤:

1:UITableViewCell drawInRect 在iOS7中失敗

解決辦法,把Cell裡的布局移到建立的View裡面,在View裡面實現DrawInRect,然後在Cell裡面載入View,代碼如下:

@implementation CustomTableViewCell- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];    if (self) {        [self.contentView addSubview:[[CustomContentView alloc]initWithFrame:self.contentView.bounds]];    }    return self;}@end
@implementation CustomContentView- (id)initWithFrame:(CGRect)frame{    self = [super initWithFrame:frame];    if (self) {        self.backgroundColor = [UIColor clearColor];    }    return self;}- (void)drawRect:(CGRect)rect{    NSDictionary * attributes = @{                                  NSFontAttributeName : [UIFont fontWithName:@"Helvetica-bold" size:12],                                  NSForegroundColorAttributeName : [UIColor blackColor]                                  };    [@"I <3 iOS 7" drawInRect:rect withAttributes:attributes];}@end

 

2:YTKNetwork的內容

YTKNetwork 是猿題庫 iOS 研發團隊基於 AFNetworking 封裝的 iOS 網路程式庫,其實現了一套 High Level 的 API,提供了更高層次的網路訪問抽象。

YTKNetwork 使用基礎教程
https://github.com/yuantiku/YTKNetwork/blob/master/BasicGuide.md

YTKNetwork 使用進階教程
https://github.com/yuantiku/YTKNetwork/blob/master/ProGuide.md

 

3:開啟跟關閉MAC隱藏的檔案

但通過在"終端"中輸入命令, 就可以在Finder中顯示出來:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

其實就是修改系統的一個設定, 再重啟Finder

同樣的道理可以讓Finder不顯示隱藏檔案:

defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

 

4:github readme.md 添加圖片 

簡要:

將圖片放在倉庫裡面,在檔案裡連結它,最後 push 到 github 上。

github 圖片連結格式:

(http://github.com/yourname/your-repository/raw/master/images-folder/xxx.png)

然後在 README.md 裡添加:

例如:我在我的 dotvim 檔案夾下一個 screenshots 目錄,在該目錄裡有一個 vim-screenshot.jpg 。那麼添加連結的方式如下

![image](https://github.com/ButBueatiful/dotvim/raw/master/screenshots/vim-screenshot.jpg)

注意:當第一次寫完ReadMe檔案後,它會儲存到項目中,如果要對它進行修改,可以在本地修改後,然後在PUSH到遠端項目中;

 

5:關於導覽列透明度的設定及頂部布局起點位置設定

屬性:translucent

關閉

self.navigationController.navigationBar.translucent = NO;

開啟

self.navigationController.navigationBar.translucent = YES;

 

屬性:automaticallyAdjustsScrollViewInsets

當 automaticallyAdjustsScrollViewInsets 為 NO 時,tableview 是從螢幕的最上邊開始,也就是被 導覽列 & 狀態列覆蓋

當 automaticallyAdjustsScrollViewInsets 為 YES 時,也是預設行為

 

6:ios 7 statusbar 狀態列 navigationbar的顏色而改變

ios7以下的版本設定導覽列背景顏色可以使用

[[UINavigationBar appearance] setTintColor:[UIColor orangeColor]];

ios7以後:

[[UINavigationBar appearance] setBarTintColor:[UIColor orangeColor]];

預設帶有一定透明效果,可以使用以下方法去除系統效果

[navigationController.navigationBar setTranslucent:NO];

 

項目需要將狀態列的文字顏色設定為白色,以下方法即可

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

改變後需要及時重新整理的調用

[viewController setNeedsStatusBarAppearanceUpdate];

如果沒有效果,需要在plist檔案裡設定

View controller-based status bar appearance  = NO

info.plist中 View controller-based status bar appearance這個屬性 View controller-based status bar appearance =NO 這個設定為:View Controller 不對status Bar 顯示進行操作

 

  

iOS開發基礎知識--片段31

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.