无法将数据发送到detailview

时间:2013-04-08 03:21:01

标签: nsstring uitextview

我正在使用集合视图从我的服务器显示一些单元格中的数据然后我有一个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这个事实有关,我发送的是一个字符串

或者如果我有错误的话

这里是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

希望有人会看到我错过了两天

1 个答案:

答案 0 :(得分:0)

再次检查之后我注意到我错过了.h中的插座而忘了将它设置在.m的ViewDidLoad中我也错过了将引用插座连接到我的txtView