仿淘宝顶部等待状态栏

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了仿淘宝顶部等待状态栏相关的知识,希望对你有一定的参考价值。

 1 <pre name="code" class="objc">#import "AppDelegate.h"  
 2   
 3   
 4   
 5 @implementation AppDelegate  
 6   
 7 - (void)dealloc  
 8 {  
 9     [_page release];  
10     [_window release];  
11     [_viewController release];  
12     [super dealloc];  
13 }  
14   
15 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions  
16 {  
17     self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];  
18     // Override point for customization after application launch.  
19       
20     self.viewController = [[[UIViewController alloc] init] autorelease];  
21     self.viewController.view.backgroundColor=[UIColor greenColor];  
22     self.window.rootViewController = self.viewController;  
23     [self.window makeKeyAndVisible];  
24       
25       
26     self.page=[[UIPageControl alloc]initWithFrame:CGRectMake(0, 0, 100, 20)];  
27       
28     self.page.backgroundColor=[UIColor clearColor];  
29     self.page.numberOfPages=3;  
30       
31     UIWindow *top_statusbar=[[UIWindow alloc]initWithFrame:CGRectMake(0, 0, 100, 20)];  
32     top_statusbar.center=CGPointMake(160, 10);  
33     [top_statusbar addSubview:self.page];  
34     top_statusbar.backgroundColor=[UIColor blackColor];  
35     [top_statusbar setHidden:NO];  
36     top_statusbar.windowLevel = UIWindowLevelStatusBar + 1.0f;  
37     top_statusbar.alpha=1;  
38       
39     [self.page release];  
40       
41     NSTimer *timer=[NSTimer timerWithTimeInterval:0.2f target:self selector:@selector(pageNumberChanged) userInfo:nil repeats:YES];  
42     [[NSRunLoop mainRunLoop]addTimer:timer forMode:NSDefaultRunLoopMode];  
43       
44       
45     return YES;  
46 }  
47 -(void)pageNumberChanged  
48 {  
49     static int i=0;  
50     i++;  
51     i=i>2?0:i;  
52     self.page.currentPage=i;  
53 }  
54   
55   
56   
57 - (void)applicationWillResignActive:(UIApplication *)application  
58 {  
59     // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.  
60     // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.  
61 }  
62   
63 - (void)applicationDidEnterBackground:(UIApplication *)application  
64 {  
65     // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.   
66     // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.  
67 }  
68   
69 - (void)applicationWillEnterForeground:(UIApplication *)application  
70 {  
71     // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.  
72 }  
73   
74 - (void)applicationDidBecomeActive:(UIApplication *)application  
75 {  
76     // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.  
77 }  
78   
79 - (void)applicationWillTerminate:(UIApplication *)application  
80 {  
81     // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.  
82 }  
83   
84 @end 

 

以上是关于仿淘宝顶部等待状态栏的主要内容,如果未能解决你的问题,请参考以下文章

js仿淘宝侧边栏滚动条

Android仿淘宝商品详情页

Flutter沉浸式状态栏/AppBar导航栏/仿咸鱼底部凸起导航

Android中仿淘宝首页顶部滚动自定义HorizontalScrollView定时水平自动切换图片

仿京东,淘宝,顶部自动轮播图

仿京东,淘宝,顶部自动轮播图