常用知識(shí)點(diǎn)集合(慢慢更新)

1.//狀態(tài)欄及背景 ?當(dāng)一個(gè)頁面需要navigation的樣子 卻又不要navigation時(shí) 可以這樣加一個(gè)view,注意是從0開始

UIView * statusBarBgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 64)];

statusBarBgView.backgroundColor = REDCOLOR;

[self.navigationController.view addSubview:statusBarBgView];


2.xib拖的UiScrollView,不能禁止上下,或者左右滑動(dòng),在如下地方設(shè)置

禁止上下滾動(dòng)選箭頭那個(gè),禁止水平滾動(dòng)選下面那個(gè)

在代碼中在配合bgScrollView.contentSize = CGSizeMake(你要的寬度, 0);

就可以禁止上下滾動(dòng)了

3.使用UIAlertController

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"請(qǐng)選擇" message:@"" preferredStyle: UIAlertControllerStyleActionSheet];

UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];

UIAlertAction *photographAction = [UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

[self takePhoto];

}];

UIAlertAction *albumAction = [UIAlertAction actionWithTitle:@"去相冊(cè)選擇" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

[self pushImagePickerController];

}];

[alertController addAction:cancelAction];

[alertController addAction:photographAction];

[alertController addAction:albumAction];

[self presentViewController:alertController animated:YES completion:nil];

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容