Adding UIActivityController on the splash screen
I took a default.png file and made it as my splash screen and i made it sleep for a few seconds to make it visible.
But i also want to add an UIA开发者_StackOverflow社区ctivityController
to it.
As i didn't take any ViewController
.
How should i add it?
- (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;
This is All i Have.
You can add Activityindicater like this
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];
}
There is no way using UIActivityController but you can do it following way
First of all, you take
in .h file
IBOutlet UIProgressView * threadProgressView;
in .m file
// 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];
}
精彩评论