Передача UIImageView между двумя UIViewController и загрузка этого UIImageView в последний UIViewController - PullRequest
0 голосов
/ 19 октября 2011

У меня есть два UIViewControllers, каждый с UIImageView, созданный с помощью IB.В первый UIViewController вы можете нарисовать поверх него UIImageView.Я копирую первый UIImageView из первого UIViewController во UIImageView второго UIViewController перед изменением показанного UIViewController.Почему UIImageView второго UIViewController ничего не показывает?

Спасибо за чтение.

РЕДАКТИРОВАН.

Впервый UIViewController Я копирую первый UIImageView следующим образом.

[secondUIViewController.secondUIImageView setImage:self.firstUIImageView.image];

EDITED 2.

Фрагмент кода лучше тысячислов.До сих пор не работает.Кто-нибудь знает, почему это не работает?

// FirstUIViewController.h

@interface FirstUIViewController : UIViewController {

    // Maintains the first one UIImageView.
    UIImageView *firstUIImageView;
}

@property (nonatomic, retain) UIImageView *firstUIImageView;

@end

// FirstUIViewController.m

// Changes the view between the FirstUIViewController and the SecondUIViewController.
- (void)gotoSecondUIViewController {

    // Gains access to the delegate and send a message to switch to a particular view.
    AppDelegate *tempDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    SecondUIViewController *tempSecondUIViewController = [[SecondUIViewController alloc] 
                           initWithNibName:@"SecondUIViewController" bundle:nil];

    tempSecondUIViewController.secondUIImageView = self.firstUIImageView;

    [tempDelegate switchToSecondUIViewController:tempSecondUIViewController animated:YES];
}

// SecondUIViewController.h

@interface SecondUIViewController : UIViewController {

    // Maintains the second one UIImageView.
    IBOutlet UIImageView *secondUIImageView;
}

@property (nonatomic, retain) IBOutlet UIImageView *secondUIImageView;

@end
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...