Saturday, 8 August 2015

Index path for custom button action inside UItableViewCell

-(void)customeButtonActionFromTableViewCell:(UIButton*) sender
{

CGPoint touchPoint = [sender convertPoint:CGPointZero toView:urTableView]; 
NSIndexPath *clickedButtonIndexPath = [urTableView indexPathForRowAtPoint:touchPoint];
 }

Thursday, 6 August 2015

Keyboard height change handling.

in viewDidLoad
[[NSNotificationCenter defaultCenter]
         addObserver:self
         selector:@selector(keyboardWasShown:)
         name:UIKeyboardWillShowNotification
         object:nil];

        [[NSNotificationCenter defaultCenter]
         addObserver:self
         selector:@selector(keyboardWillBeHidden:)
         name:UIKeyboardWillHideNotification
         object:nil];
// Called when the UIKeyboardDidShowNotification is sent.
- (void)keyboardWasShown:(NSNotification *)aNotification {

    [self scrollControlBarTo:aNotification up:YES];

}

// Called when the UIKeyboardWillHideNotification is sent
- (void)keyboardWillBeHidden:(NSNotification *)aNotification {


     [self scrollControlBarTo:aNotification up:NO];

}


- (void)scrollControlBarTo:(NSNotification *)notification up:(BOOL)up
{

    CGRect keyboardBounds;
    NSDictionary *info = [notification userInfo];
    NSNumber *number = [info objectForKey:UIKeyboardAnimationDurationUserInfoKey];
    double duration = [number doubleValue];
    [[info objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardBounds];
    [UIView animateWithDuration:duration
                          delay:0
                        options:UIViewAnimationOptionCurveLinear
                     animations:^{
                         containerBottom.constant = (up) ? 8+keyboardBounds.size.height : 8;
                         [self.view layoutIfNeeded];
                     } completion:nil];
}

Friday, 17 July 2015

Mpmovieplayerviewcontroller support Landscape.

In the application Delegate file.
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{

    if ([NSStringFromClass([[self.window.rootViewController presentedViewController] class]) isEqualToString:@"MPInlineVideoFullscreenViewController"]&&[self.window.rootViewController presentedViewController].isBeingDismissed)
    {
        return UIInterfaceOrientationMaskPortrait;
    }
    if ([NSStringFromClass([[self.window.rootViewController presentedViewController] class]) isEqualToString:@"MPInlineVideoFullscreenViewController"])
        return UIInterfaceOrientationMaskAll;
    else
        return UIInterfaceOrientationMaskPortrait;

}

Tuesday, 9 June 2015

Cocopods Installation Progress.

For installing Cocopods
sudo gem install cocoapods -V

For installing pods
pod install --verbose 

You can run pod install --no-repo-update if you do not want to perform a repo update.

Monday, 1 June 2015

Device check and Screen size

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)