Wednesday, October 9, 2013

Font Family Check in Xcode

NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
    NSLog(@”Family name: %@”, [familyNames objectAtIndex:indFamily]);
    fontNames = [[NSArray alloc] initWithArray:
                 [UIFont fontNamesForFamilyName:
                  [familyNames objectAtIndex:indFamily]]];
    for (indFont=0; indFont<[fontNames count]; ++indFont)
        NSLog(@” Font name: %@”, [fontNames objectAtIndex:indFont]);
    [fontNames release];


Tuesday, October 8, 2013

Move NavigationController for iOS7

Converting iOS 6 app to iOS 7 there is a problem with top navigation for iOS 7. So i found a solution for this. 

Note: Although there are a lot of solutions for this like delta updating in NIB file. but i found this useful and applied in my current project as well.

It should be added in AppDeletegate Class and in didFinishLaunchingWithOptions function before return YES;

    CGRect aRect = self.navigationController.view.frame;
        aRect.origin.y = 20.0f;
        aRect.size.height -= aRect.origin.y;
        aRect.origin.y = 0.0;
    self.navigationController.view.frame = aRect;
    [self.window setBackgroundColor:[UIColor whiteColor]];

Thursday, October 3, 2013

Hide Keyboard for presentViewController

Hi, i found an issue that if you are using presentViewController then resignFirstResponder doesn't hide the keyboard. We can follow the below method for hiding keyboard

Just write the below code and add resignFirstResponder. it should work then 
    return NO;


Tuesday, October 1, 2013

UIActionSheet Menu in Xcode

To Show a Menu Sheet like below

We have to code as below

1. First of all, we need to add <UIActionSheetDelegate> delegate in class .h file

2. Now we have to code like below

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select Image from..." delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Camera", @"Image Gallary", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
actionSheet.tag = 1;
UIWindow* window = [[UIApplication sharedApplication] keyWindow];
if ([window.subviews containsObject:self.view]) {
    [actionSheet showInView:self.view];
} else {
    [actionSheet showInView:window];