UICollectionView の詳細ビューを表示するために、MZFormSheetController というカスタム ModalViewController を使用しています。現在、次のようなモーダル ビュー コントローラーにプロパティを作成しました。
@property (strong,nonatomic) NSString *user;
@property (strong,nonatomic) NSString *caption;
@property (weak, nonatomic) IBOutlet UILabel *username;
@property (weak, nonatomic) IBOutlet UILabel *captiontext;
そして、ユーザーが次のように UICollectionViewCell をタップしたときに、詳細ビュー コントローラーの表示を設定しようとしました。
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 のストーリーボードに 2 つのラベルを作成し、このように MainViewController のキャプションとユーザーの値と等しくしようとしました。
[self.username.text isEqualToString:self.user];
[self.captiontext.text isEqualToString:self.caption];
ただし、このすべての後、モーダルビューコントローラーのラベルはまだこのようにラベルを付けています..