0
我正在使用集合視圖從我的服務器獲取數據在單元格中顯示它的一些,然後我有一個segue到目標視圖控制器我得到的圖像正確地更新,但由於某種原因文本是不是要我的UITextView發送數據到detailview的問題
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
//DetailSegue
if ([segue.identifier isEqualToString:@"DetailSegue"]) {
ICBCollectionViewCell *cell = (ICBCollectionViewCell *)sender;
NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];
ICBDetailViewController *dvc = (ICBDetailViewController *)[segue destinationViewController];
path = [paths objectAtIndex:indexPath.row];
Path = [path objectForKey:@"path"];
title = [titles objectAtIndex:indexPath.row];
Title = [title objectForKey:@"title"];
sku = [SKUs objectAtIndex:indexPath.row];
Sku = [sku objectForKey:@"SKU"];
longDescrip = [longDescription objectAtIndex:indexPath.row];
LongDescrip = [longDescrip objectForKey:@"longDescrip"];
LongDescrip [email protected]"Hello World";
NSLog(@"Descrip =%@",LongDescrip);
NSString *iconTitle =[NSString stringWithFormat:@"%@.png",Sku];
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *fullPath = [docDir stringByAppendingPathComponent:[NSString stringWithFormat:@"/%@",iconTitle]]; //add our image to the path
dvc.img = [[UIImage alloc] initWithContentsOfFile:fullPath];
dvc.title = Title;
//UITextView *descrip = (UITextView *)[cell viewWithTag:120];
[dvc.descrip setText:@"Hello"];
}
}
我不知道它是否有事可做的事實,正在發送的對象是一個UITextView,我送一個字符串
或者如果我有東西掛錯了
這裏是爲detailController的.M和.h也
的.H
#import <UIKit/UIKit.h>
@interface ICBDetailViewController : UIViewController
@property(weak) IBOutlet UIImageView *imageView;
@property (strong) UIImage *img;
@property(weak) IBOutlet UITextView *descrip;
@end
的.M
#import "ICBDetailViewController.h"
@interface ICBDetailViewController()
@end
@implementation ICBDetailViewController
@synthesize imageView, img, descrip;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.imageView.image = self.img;
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
希望有人會明白我已經錯過了兩個天