我使用名为 MZFormSheetController 的自定义 ModalViewController 来显示 UICollectionView 的详细信息视图。目前我已经在模态视图控制器中创建了属性,例如:
@property (strong,nonatomic) NSString *user;
@property (strong,nonatomic) NSString *caption;
@property (weak, nonatomic) IBOutlet UILabel *username;
@property (weak, nonatomic) IBOutlet UILabel *captiontext;
当用户像这样点击 UICollectionViewCell 时,我尝试设置详细视图控制器的显示: - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *entry = [self entries][indexPath.row];
NSDictionary *text = [self entries][indexPath.row];
ModalViewController *m = [self.storyboard instantiateViewControllerWithIdentifier:@"modalView"];
m.entry = [self entries][indexPath.row];
m.text = [self entries][indexPath.row];
m.user = entry[@"user"][@"full_name"];
m.caption = text[@"caption"][@"text"];
MZFormSheetController *formSheet = [[MZFormSheetController alloc] initWithViewController:m];
formSheet.transitionStyle = MZFormSheetTransitionStyleDropDown;
formSheet.shouldDismissOnBackgroundViewTap = YES;
[formSheet presentAnimated:YES completionHandler:^(UIViewController *presentedFSViewController) {
}];
formSheet.didTapOnBackgroundViewCompletionHandler = ^(CGPoint location)
{
};
}
我在情节提要中为 modalviewcontroller 创建了两个标签,并尝试使它们等于 MainViewController 中的标题和用户值,如下所示
[self.username.text isEqualToString:self.user];
[self.captiontext.text isEqualToString:self.caption];
然而,在这一切之后,模态视图控制器的标签仍然像这样说标签..