1.//状态栏及背景 当一个页面需要navigation的样子 却又不要navigation时 可以这样加一个view,注意是从0开始
UIView * statusBarBgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 64)];
statusBarBgView.backgroundColor = REDCOLOR;
[self.navigationController.view addSubview:statusBarBgView];
2.xib拖的UiScrollView,不能禁止上下,或者左右滑动,在如下地方设置
禁止上下滚动选箭头那个,禁止水平滚动选下面那个在代码中在配合bgScrollView.contentSize = CGSizeMake(你要的宽度, 0);
就可以禁止上下滚动了
3.使用UIAlertController
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"请选择" 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:@"去相册选择" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self pushImagePickerController];
}];
[alertController addAction:cancelAction];
[alertController addAction:photographAction];
[alertController addAction:albumAction];
[self presentViewController:alertController animated:YES completion:nil];
网友评论