2011-09-28 84 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