我正在使用集合视图从我的服务器获取数据,在单元格中显示其中的一些数据,然后我对目标视图控制器有一个 segue 我得到了正确更新的图像,但由于某种原因,文本不会进入我的 UITextView
- (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 =@"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 并且我正在向它发送 String 的事实有关
或者如果我有什么错误
这里也是 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
他们
#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
希望有人能看到我两天错过的东西