2011-11-23 17 views
6

Tôi đang làm việc trên iOS 5. Tôi không thể tìm thấy mẫu ứng dụng dựa trên điều hướng trước đây được tìm thấy trong Xcode.Không thể tìm thấy mẫu dự án mới của Xcode 4 cho ứng dụng điều khiển dựa trên điều hướng. Bất kỳ thay thế nào?

Vì vậy, tôi có thể sử dụng thay vào đó?

+0

Tương tự như câu hỏi: http://stackoverflow.com/questions/8196123/replacement-for-navigation-based-application-template-in-xcode-4-2?lq=1 –

Trả lời

8

Bạn cần sử dụng mẫu Ứng dụng chi tiết chính. Chọn Gia đình thiết bị từ danh sách thả xuống dưới dạng iPhone. Sau khi tạo dự án, appDelegate của bạn sẽ chứa ví dụ UINavigationController.

@interface AppDelegate : UIResponder <UIApplicationDelegate> 

@property (strong, nonatomic) UIWindow *window; 
@property (strong, nonatomic) UINavigationController *navigationController; 

@end 

@implementation AppDelegate 

@synthesize window = _window; 
@synthesize navigationController = _navigationController; 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 
    // Override point for customization after application launch. 

    MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil] autorelease]; 
    self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease]; 
    self.window.rootViewController = self.navigationController; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 
+0

Rất tuyệt! Tôi đọc cách tốt nhất để làm điều đó là thông qua một dự án dựa trên chế độ xem đơn, nhưng điều này có vẻ giống như một mẫu dựa trên điều hướng cũ hơn. Vẫn nghĩ rằng đó là một quả táo lạ khiến nó rất mơ hồ ... đó là mẫu được sử dụng nhiều nhất của tôi: P – Warkst

3

Sử dụng bảng phân cảnh và kéo trình điều khiển chế độ xem vào đó. Sau đó, đi Trình chỉnh sửa> Nhúng trong> Trình điều khiển điều hướng.

12

Nếu bạn muốn bắt đầu từ đầu, hãy bắt đầu với dự án Single View Based, sau đó chuyển đến bảng phân cảnh và chọn viewController, chuyển đến Trình chỉnh sửa> Nhúng trong> Bộ điều khiển điều hướng.

+0

Bạn làm đẹp! Đây chính xác là những gì tôi cần, cổ vũ matey – Elmo

+0

đây phải là câu trả lời đúng. không phải là chi tiết chính – OMGPOP

Các vấn đề liên quan