2011-11-02 1 views

답변

16
MyViewController * myVC = [[MyViewController alloc] initWithNibName:nil bundle:nil]; 
myVC.someProperty = someValue; // Pass your data here 
[self.navigationController pushViewController:myVC animated:YES]; 

그리고 :

.H

@interface MyViewController : UIViewController 
@property (nonatomic, strong) NSString * someProperty; 
@end 

하는 .m

@implementation MyViewController 

    - (void)viewDidLoad { 
     [super viewDidLoad]; 
     // your data has been set 
     // self.someProperty is equal to "some value" 
    } 
1

믿을 수는 없지만 물론 관련 속성이나 메서드를 ViewController 클래스에 추가하고이를 푸시하기 전에 사용할 수 있습니다.

+1

내가 쓴 것은 정확히 수용된 대답이 코드에서하는 것과 같은 것입니다. – Clafou

0

아니요. NSBundle을 Android의 Bundle과 동일시 할 수 있지만 관련이 없으며 유사한 작업을 수행하지 않습니다. Clafou는 메서드와 속성을 통해 데이터를 전달할 것을 제안하는 것이 옳습니다. 당신의 MyViewController 클래스