1.隱藏狀態列 [ [ UIApplication sharedApplication ] setStatusBarHidden:YES animated:NO ];
2.開啟手機相簿
首先引入 UIImagePickerControllerDelegate協議
UIImagePickerController *imgPickerController = [[UIImagePickerControlleralloc]init];
imgPickerController.delegate =self;
imgPickerController.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;
[selfpresentViewController:self.imgPickerControlleranimated:YEScompletion:nil];
3.判斷運行裝置種類並顯示
NSString *deviceType = [UIDevicecurrentDevice].model;
NSLog(@"current device type:%@",deviceType);
4.Tabbar圖片上的數字
self.tabBarItem.badgeValue = [NSStringstringWithFormat:@"%d",9];
5.TableView 去掉cell之間的線
myTableView.separatorStyle =UITableViewCellSeparatorStyleNone;
6.載入本地檔案PDF
NSURL *URL = [[NSBundle mainBundle] URLForResource:@"sample" withExtension:@"pdf"];
7.
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(btnImageView:)];
[self.imageViewaddGestureRecognizer:singleTap];
-(void)btnImageView:(id)sender {
CABasicAnimation* shake = [CABasicAnimationanimationWithKeyPath:@"transform.rotation.z"];
//設定抖動幅度
shake.fromValue = [NSNumbernumberWithFloat:-0.1];
shake.toValue = [NSNumbernumberWithFloat:+0.1];
shake.duration =0.1;
shake.autoreverses =YES;//是否重複
shake.repeatCount =4;
[self.imageView.layeraddAnimation:shakeforKey:@"imageView"];
self.imageView.alpha =1.0;
[UIViewanimateWithDuration:2.0delay:2.0options:UIViewAnimationOptionCurveEaseInanimations:nilcompletion:nil];
}
8.
//UITableView設定背景為透明
table.backgroundView = nil;
table.backgroundColor = [UIColor clearColor];
table.opaque = NO;
9.
將一個UIView顯示在最前面只需要調用其父視圖的 bringSubviewToFront()方法。
將一個UIView層推送到背後只需要調用其父視圖的 sendSubviewToBack()方法。