示例程序:
UIVisualEffectView
UIBlurEffect *effect = [UIBlurEffecteffectWithStyle:UIBlurEffectStyleLight];
_backgroundView = [[UIVisualEffectViewalloc] initWithEffect:effect];
_backgroundView.contentView.backgroundColor = [UIColorcolorWithWhite:0.7alpha:0.3];
[selfaddSubview:_backgroundView];
1 // 清空选中cell,是tableviewController的属性,不是tableview的。
self.clearsSelectionOnViewWillAppear =NO;
2 [[NSNotificationCenterdefaultCenter] removeObserver:selfname:UIViewControllerShowDetailTargetDidChangeNotificationobject:nil];
// Sometimes view controllers that are using showViewController:sender and showDetailViewController:sender: will need to know when the split view controller environment above it has changed. This notification will be posted when that happens (for example, when a split view controller is collapsing or expanding). The NSNotification's object will be the view controller that caused the change.
UIKIT_EXTERN NSString *const UIViewControllerShowDetailTargetDidChangeNotificationNS_AVAILABLE_IOS(8_0);
[self showViewController:xiuGai sender:self];[self showDetailViewController:xiuGai sender:self];
3 static NSString *const AAPLListTableViewControllerCellIdentifier =@"Cell";
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:AAPLListTableViewControllerCellIdentifier];// 自动创建新的cell或者复用cell
// 懒加载数据
- (void)setUser:(AAPLUser *)user
{
if (_user != user) {
_user = user;
if ([self isViewLoaded]) {
[self.tableView reloadData];
}
}
}
4 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
5 @property ( copy , nonatomic ) NSArray *conversations; // NSArray用copy6 + (instancetype)photoWithDictionary:(NSDictionary *)dictionary
{
AAPLPhoto *photo = [[selfalloc] init];
photo.imageName = [dictionaryobjectForKey:@"imageName"];
photo.comment = [dictionaryobjectForKey:@"comment"];
photo.rating = [[dictionaryobjectForKey:@"rating"]integerValue];
return photo;
}
7
AAPLProfileViewController *controller = [[AAPLProfileViewControlleralloc] init];
controller.navigationItem.rightBarButtonItem = [[UIBarButtonItemalloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:selfaction:@selector(closeProfile:)];
UINavigationController *navController = [[UINavigationControlleralloc] initWithRootViewController:controller];
navController.modalPresentationStyle =UIModalPresentationPopover;
navController.popoverPresentationController.barButtonItem = sender;
navController.popoverPresentationController.permittedArrowDirections =UIPopoverArrowDirectionAny;
[selfpresentViewController:navControlleranimated:YEScompletion:NULL];