使用自定義的ModalViewController調用MZFormSheetController來顯示UICollectionView的Detail View。在模態視圖控制器目前我已經創建性能如這些:DetailViewController以編程方式iOS
@property (strong,nonatomic) NSString *user;
@property (strong,nonatomic) NSString *caption;
@property (weak, nonatomic) IBOutlet UILabel *username;
@property (weak, nonatomic) IBOutlet UILabel *captiontext;
我嘗試當用戶點按UICollectionViewCell這樣來設定細節視圖控制器的顯示: - (無效)的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];
然而在此之後所有的模態視圖控制器的標籤仍然說標籤這樣的..
2013年8月31日23:48:00.962 Floadt [1363:C07] - [的UILabel isEqualToString:]:無法識別的選擇發送到實例0xba809c0 2013年8月31日23:48:00.963 Floadt [1363: c07] ***終止應用程序由於未捕獲的異常'NSInvalidArgumentException',原因:' - [UILabel isEqualToString:]:無法識別的選擇器發送到實例0xba809c0' – Prad
我得到了那個錯誤^^^ – Prad
@ prnk28這意味着你打電話標籤上的'isEqualToString:'。你可能想看看[類的引用](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/對於'isEqualToString:',instm/NSString/isEqualToString :)。 – shearnonsense