Monday, 22 June 2015

Find the System Name & Screen Size

Find the Screen Size
CGSize result = [[UIScreen mainScreenbounds].size;

Find the System Name
#import <sys/utsname.h>
-(void)findversiondetails
{
    //Find device type
    struct utsname systemInfo;
     uname(&systemInfo);
     
     NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
     
     if ([deviceModel isEqualToString:@"iPhone4,1"] || [deviceModel isEqualToString:@"iPhone3,3"] || [deviceModel isEqualToString:@"iPhone3,2"] || [deviceModel isEqualToString:@"iPhone3,1"])
     {
         UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Title" message:deviceModel delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
         [alert show];
     }
}

No comments: