通讯录实现草图: 

UI:通讯录实现

 

代码:

#pragma mark (.h文件)--------------------------------------------------------------------------------------------------------
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (retain, nonatomic) UIWindow *window;


@end
#pragma mark (.m文件)--------------------------------------------------------------------------------------------------------
#import "AppDelegate.h"
#import "ContactListViewController.h"
#import "MainNavigationController.h"
#import "FirstLaunchViewController.h"
@interface AppDelegate ()

@end

@implementation AppDelegate
- (void)dealloc {
    [_window release];
    [super dealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    //判断是否第一次安装启动
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    //如果是 则指定用户引导页为window的根视图控制器
    if (![defaults boolForKey:@"firstLaunch"]) {
        FirstLaunchViewController *firstVC = [[FirstLaunchViewController alloc] init];
        self.window.rootViewController = firstVC;
        [firstVC release];
    } else {
    //否则,进入程序的主页面
    //设置根视图控制器
    ContactListViewController *mainVC = [[ContactListViewController alloc] initWithStyle:UITableViewStylePlain];
    //创建导航控制器
    MainNavigationController *navi = [[MainNavigationController alloc] initWithRootViewController:mainVC];
    //指定为window的根视图控制器
    self.window.rootViewController = navi;
    //释放所有权
    [mainVC release];
    [navi release];
    }
    
    return YES;
}
View Code AppDelegate文件

相关文章: