コレクションビューを使用してサーバーからデータを取得し、その一部をセルに表示します。次に、画像を正しく更新する目的のビューコントローラーにセグエがありますが、何らかの理由でテキストが 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
彼ら
#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
願わくば、誰かが私が2日間見逃したものを見てくれることを願っています