Tuesday, 16 April 2013

Static landscape orientation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
    if(toInterfaceOrientation == 1 || toInterfaceOrientation == 2)
        return NO;
        return UIInterfaceOrientationMaskLandscape;

Friday, 12 April 2013

To add a Toolbar and many buttons on that in iOS

UIToolbar* toolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 40, 480, 240)]; 

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Home"
                                                                   style:UIBarButtonItemStyleDone target:nil action:nil
    UIBarButtonItem *a = [[UIBarButtonItem alloc] initWithTitle:@"Library"
                                                          style:UIBarButtonItemStyleDone target:nil action:@selector(goHome)];
    UIBarButtonItem *b = [[UIBarButtonItem alloc] initWithTitle:@"AbC"
                                                          style:UIBarButtonItemStyleDone target:nil action:@selector(goToPage)];
    UIBarButtonItem *c = [[UIBarButtonItem alloc] initWithTitle:@"Bookmark"
                                                          style:UIBarButtonItemStyleDone target:nil action:nil];
    UIBarButtonItem *d = [[UIBarButtonItem alloc] initWithTitle:@"Help"
                                                          style:UIBarButtonItemStyleDone target:nil action:nil];
    NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:5];
    [buttons addObject:backButton];
    [buttons addObject:a];
    [buttons addObject:b];
    [buttons addObject:c];
    [buttons addObject:d];

[self.view addSubview: toolBar];

To run a loop from A to Z


    for (char * ptr = letters; *ptr != 0; ++ptr)
        char ch = *ptr;

To fetch plist data

NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"position" ofType:@"plist"];

NSArray*  contentArray = [NSArray arrayWithContentsOfFile:plistPath];

To check the current device is ipad retina or not.

if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2.0) 
 // is retina display

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
//normal ipad

Monday, 8 April 2013

How to upload iOS app on app store

How to upload iOS app on app store

First go to developer.apple.com
then  > IOS dev center
then  > create an app id
then  > create distribution profile

Now come back to Xcode / organizer/ devices and refresh the list and select the distribution certificate

then go to https://itunesconnect.apple.com
then  > manage your apps and add a new app and fill the details and when ready to upload a binary

then come back to Xcode and make a ARCHIVE and validate and distribute it from organizer.

>> Worked for me may be help you out.