我遇到了一些標籤問題。我做了一個公共方法,它從表視圖獲取信息,並在3標籤,文本視圖中顯示此信息,並從網站加載圖片。我在表視圖didSelectRowAtIndexPath方法中設置了所有變量,但我在顯示該信息時遇到了一些問題。在表視圖控制器 我打電話給其他方法,以便::我做了這麼在標籤上設置文本時出現iOS 6問題
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.detailCharacterViewController = [[DetailCharacterViewController alloc] init];
[self.detailCharacterViewController setupDetailViewControllerWithName:[self.arrayCharacters[indexPath.row] objectForKey:@"name"] andSurname:[self.arrayCharacters[indexPath.row] objectForKey:@"surname"] andKind:[self.arrayCharacters[indexPath.row] objectForKey:@"kind"] andDescription:[self.arrayCharacters[indexPath.row] objectForKey:@"description"] andImage:[self.arrayCharacters[indexPath.row] objectForKey:@"URLpic"]];
}
和我實現了方法,以便:
- (void)setupDetailViewControllerWithName:(NSString*)name andSurname:(NSString *)surname andKind:(NSString*) kind andDescription:(NSString*)description andImage:(NSString*)url {
NSLog(@"name = %@", name);
self.labelName.text = name;
self.labelSurname.text = surname;
self.labelKind.text = kind;
self.textDescription.text = description;
NSURL *urlPic = [NSURL URLWithString:url];
NSData *dataPic = [NSData dataWithContentsOfURL:urlPic];
[self.imagePic setImage:[UIImage imageWithData:dataPic]];
}
如果我看的日誌我看到正確的事,但如果我在iPhone或iPhone模擬器上查看GUI,它將保持空白。這段代碼有什麼問題? 謝謝你的建議。
@Alex布倫德爾
#import <UIKit/UIKit.h>
@interface DetailCharacterViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *labelName;
@property (weak, nonatomic) IBOutlet UILabel *labelSurname;
@property (weak, nonatomic) IBOutlet UILabel *labelKind;
@property (weak, nonatomic) IBOutlet UIImageView *imagePic;
@property (weak, nonatomic) IBOutlet UITextView *textDescription;
- (void)setupDetailViewControllerWithName:(NSString*)name andSurname:(NSString *)surname andKind:(NSString*) kind andDescription:(NSString*)description andImage:(NSString*)url;
@end
檢查掛接或不出口。 –