所以我有一個帶有IBAction標題的按鈕,它的initWithNibName方法指向另一個ViewController。一切都嵌入在NavigationController中。initWithNibName:我沒有滾動和沒有導航欄?
我還創建了這個視圖控制器一個的.xib,這裏是一個快速截圖:
這裏是我的代碼:
.H
@interface ModeEmploiController : UIViewController
{
IBOutlet UIScrollView *scrollView;
UITextView *vueOffres, *vueInfos, *vueGrilles;
}
@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
.M
@implementation ModeEmploiController
@synthesize scrollView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
[scrollView setScrollEnabled:YES];
[scrollView setContentSize:CGSizeMake(320, 529)];
// Here I define vueOffres, vueInfos and vueGrilles and for each of them :
[self.view addSubview:vueGrilles/vueInfos/vueOffres];
}
}
但是,當我運行我的應用程序,我的滾動未啓用,我沒有我的導航控制器的導航欄。發生了什麼?
你如何初始化你的導航控制器? – Eimantas
實際上,我只是添加了它,並將其嵌入到IB的視圖控制器中。 – Rob