2011-09-28 122 views
0

我拿了一個default.png文件,並將其作爲我的啓動畫面,並讓它睡幾秒鐘以使其可見。在初始屏幕上添加UIActivityController

但我也想添加一個UIActivityController它。 因爲我沒有采取任何ViewController

我應該如何添加它?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

_homeViewController = [[XTHomeViewController alloc]initWithNibName:kHOME_VIEW bundle:nil]; 
_navigate = [[UINavigationController alloc]initWithRootViewController:_homeViewController]; 

[self.window addSubview:_navigate.view]; 
[self.window makeKeyAndVisible]; 
[NSThread sleepForTimeInterval:0.75]; 
return YES; 

這是我的全部。

回答

1

您可以像這樣添加Activityindicater

in DemoappeDelegate.h file 

IBOutlet UiView *splashView; 

in DemoappDelegate.m 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

    UIActivityIndicatorView *spinningWheel = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(145.0, 290.0, 25.0, 25.0)]; 
    [spinningWheel startAnimating]; 
    spinningWheel.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; 
    [splashView addSubview:spinningWheel]; 
    [spinningWheel release]; 
} 
+0

我張貼我的代碼above.i添加到它的代碼,它不工作。 – Chandu

1

有使用UIActivityController沒有辦法,但你可以做到這一點下面的方式

首先,你在.m文件採取

在.h文件中

IBOutlet UIProgressView * threadProgressView; 

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 
    - (void)viewDidLoad 
    { 

     threadProgressView.progress = 0.0; 
     [self performSelectorOnMainThread:@selector(makeMyProgressBarMoving) withObject:nil waitUntilDone:NO]; 
     [super viewDidLoad]; 
    } 

//For progress bar 

- (void)makeMyProgressBarMoving { 

    float actual = [threadProgressView progress]; 
    if (actual < 1) { 
     threadProgressView.progress = actual + 0.02; 
     [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(makeMyProgressBarMoving) userInfo:nil repeats:NO]; 
    } 
+0

所以你想讓我另一個viewcontroller的splashscreen ??。我們不這樣做沒有一個新的ViewController? – Chandu

+0

您是使用基於窗口還是基於視圖的應用程序? –

+0

我正在使用基於窗口的應用程序。 – Chandu