см. Это ----
- (void)viewDidLoad {
[super viewDidLoad];
// [self ShowMsg];
//-----------------checking version of IOS -----------------------------------
CGFloat ver = [[[UIDevice currentDevice]systemVersion]floatValue];
NSString *str = [NSString stringWithFormat:@"%f",ver];
NSLog(@"%@",str);
NSArray *arr = [str componentsSeparatedByString:@"."];
strVerChk = [arr objectAtIndex:0];
NSLog(@"%@",strVerChk);
[strVerChk retain];
NSInteger verChk = [[NSString stringWithFormat:@"%@",strVerChk]intValue];
NSLog(@"integer %d",verChk);
if (verChk < 5) {
imag = [UIImage imageNamed:@"WaitScreen.png"];
}
else
{
imag = [UIImage imageNamed:@"WaitScreen_5.png"];
}
Lblmsg = [[UILabel alloc]init];
//WithFrame:CGRectMake(10, 10, 100, 30)];
Lblmsg.backgroundColor = [UIColor clearColor];
Lblmsg.textColor = [UIColor whiteColor];
Lblmsg.text = @" Please Wait....";
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
[Lblmsg setFont:[UIFont fontWithName:@"Arial" size:16]];
}else
{
[Lblmsg setFont:[UIFont fontWithName:@"Arial" size:12]];
}
Lblmsg.textAlignment = UITextAlignmentCenter;
activityInd = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
// [activityInd startAnimating];
imageview = [[UIImageView alloc]initWithImage:imag];
[imageview addSubview:Lblmsg];
[imageview addSubview:activityInd];
[self.view addSubview:imageview];
self.view.backgroundColor = [UIColor clearColor];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
// self.interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if(orientation == UIInterfaceOrientationPortrait ||orientation == UIInterfaceOrientationPortraitUpsideDown)
{
self.view.frame = CGRectMake(0, 0, 320, 480);
imageview.frame = CGRectMake(100, 130, 120, 80);
}
else{
self.view.frame = CGRectMake(0, 0, 480, 320);
imageview.frame = CGRectMake(180, 70, 120, 80);
}
Lblmsg.frame = CGRectMake(0, 45, 120, 40);
NSInteger verChk = [[NSString stringWithFormat:@"%@",strVerChk]intValue];
NSLog(@"integer %d",verChk);
if (verChk < 5) {
activityInd.frame = CGRectMake(41, 9, 28, 28);
}
else
{
activityInd.frame = CGRectMake(41, 9, 28, 28);
}
[activityInd startAnimating];
}
else{
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if(orientation == UIInterfaceOrientationPortrait ||orientation == UIInterfaceOrientationPortraitUpsideDown)
{
self.view.frame = CGRectMake(0, 0, 768, 1024);
imageview.frame = CGRectMake(274, 330, 210, 160);
Lblmsg.frame = CGRectMake(10, 115, 190, 30);
NSInteger verChk = [[NSString stringWithFormat:@"%@",strVerChk]intValue];
NSLog(@"integer %d",verChk);
if (verChk < 5) {
activityInd.frame = CGRectMake(71, 20, 52, 52);
}
else
{
activityInd.frame = CGRectMake(71, 20, 49, 49);
}
[activityInd startAnimating];
}
else{
self.view.frame = CGRectMake(0, 0, 1024, 768);
imageview.frame = CGRectMake(390, 264, 200, 150);
Lblmsg.frame = CGRectMake(10, 115, 180, 30);
NSInteger verChk = [[NSString stringWithFormat:@"%@",strVerChk]intValue];
NSLog(@"integer %d",verChk);
if (verChk < 5) {
activityInd.frame = CGRectMake(68, 17, 52, 52);
}
else
{
activityInd.frame = CGRectMake(68, 17, 49, 49);
}
[activityInd startAnimating];
}
}
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didRotate)
name:@"UIDeviceOrientationDidChangeNotification" object:nil];
}
-(void)didRotate{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
// self.interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if(orientation == UIInterfaceOrientationPortrait ||orientation == UIInterfaceOrientationPortraitUpsideDown)
{
self.view.frame = CGRectMake(0, 0, 320, 480);
imageview.frame = CGRectMake(100, 130, 120, 80);
//Lblmsg.frame = CGRectMake(0, 40, 120, 30);
//activityInd.frame = CGRectMake(20, 10, 80, 30);
}
else{
self.view.frame = CGRectMake(0, 0, 480, 320);
imageview.frame = CGRectMake(180, 70, 120, 80);
//activityInd.frame = CGRectMake(20, 10, 80, 30);
//activityInd.frame = CGRectMake(50, 15, 10, 10);
//[activityInd startAnimating];
}
Lblmsg.frame = CGRectMake(0, 45, 120, 40);
NSInteger verChk = [[NSString stringWithFormat:@"%@",strVerChk]intValue];
NSLog(@"integer %d",verChk);
if (verChk < 5) {
activityInd.frame = CGRectMake(41, 9, 28, 28);
}
else
{
activityInd.frame = CGRectMake(41, 9, 28, 28);
}
[activityInd startAnimating];
}
else{
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if(orientation == UIInterfaceOrientationPortrait ||orientation == UIInterfaceOrientationPortraitUpsideDown)
{
self.view.frame = CGRectMake(0, 0, 768, 1024);
imageview.frame = CGRectMake(274, 330, 210, 160);
Lblmsg.frame = CGRectMake(10, 115, 190, 30);
NSInteger verChk = [[NSString stringWithFormat:@"%@",strVerChk]intValue];
NSLog(@"integer %d",verChk);
if (verChk < 5) {
activityInd.frame = CGRectMake(71, 20, 52, 52);
}
else
{
activityInd.frame = CGRectMake(71, 20, 49, 49);
}
[activityInd startAnimating];
}
else{
self.view.frame = CGRectMake(0, 0, 1024, 768);
imageview.frame = CGRectMake(390, 264, 200, 150);
Lblmsg.frame = CGRectMake(10, 115, 180, 30);
NSInteger verChk = [[NSString stringWithFormat:@"%@",strVerChk]intValue];
NSLog(@"integer %d",verChk);
if (verChk < 5) {
activityInd.frame = CGRectMake(68, 17, 52, 52);
}
else
{
activityInd.frame = CGRectMake(68, 17, 49, 49);
}
[activityInd startAnimating];
}
}
}