#import <UIKit/UIKit.h>
@interface Appdelegate:uiresponder <UIApplicationDelegate>
{
@public
Nsinteger TimeValue;
}
@property (Strong, nonatomic) UIWindow *window;
@end
#import "AppDelegate.h"
@interface Appdelegate ()
@end
@implementation Appdelegate
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {
[UIScreen mainscreen].bounds get the screen size of the hardware device
CGRectMake (0, 0, 320, 568) Setting the screen size is not variable
Self.window=[[uiwindow Alloc]initwithframe:[uiscreen Mainscreen].bounds];
Self.window=[[uiwindow alloc]initwithframe:cgrectmake (0, 0, 320, 568-20)];//run only once
Self.window.backgroundcolor=[uicolor redcolor];//Setting the background color
[Nstimer scheduledtimerwithtimeinterval:1 target:self selector: @selector (timeraction:) Userinfo:nil Repeats:yes];
Marquee idea-"Set timer characteristics, run once per second"-"Set global variables TimeValue settings-" Two by odd even, more than one set a local variable to find the remainder. Can. or direct introduction of digital redundancy is also possible. The above and below comments are all error-based and are for training.
[Self.window makekeyandvisible]; //Let the currently generated window appear at the front end
window design, color set, before the front of the window to add things
return YES;
}
-(void) Timeraction: (Nstimer *) timer{
UIView *aview=[[uiview Alloc]initwithframe:cgrectmake (45, 45, 230, 468)];
UIView *aview1=[[uiview Alloc]initwithframe:cgrectmake (90, 90, 140, 368)];
UIView *aview2=[[uiview Alloc]initwithframe:cgrectmake (135, 135, 50, 268)];
timevalue++;
int i=3;
if (timevalue%i==0) {
Aview.backgroundcolor=[uicolor Yellowcolor];
Aview1.backgroundcolor=[uicolor Bluecolor];
Aview2.backgroundcolor=[uicolor Greencolor];
[Self.window Addsubview:aview];
[Self.window Addsubview:aview1];
[Self.window Addsubview:aview2];
}
if (timevalue%i==1) {
Aview.backgroundcolor=[uicolor Bluecolor];
Aview1.backgroundcolor=[uicolor Greencolor];
Aview2.backgroundcolor=[uicolor Yellowcolor];
[Self.window Addsubview:aview];
[Self.window Addsubview:aview1];
[Self.window Addsubview:aview2];
}
if (timevalue%i==2) {
Aview.backgroundcolor=[uicolor Greencolor];
Aview1.backgroundcolor=[uicolor Yellowcolor];
Aview2.backgroundcolor=[uicolor Bluecolor];
[Self.window Addsubview:aview];
[Self.window Addsubview:aview1];
[Self.window Addsubview:aview2];
}
}
@end
Three-color space-time Gate type marquee 1