Skip to content

Instantly share code, notes, and snippets.

View JigarM's full-sized avatar
🏠
Working from home

Jigar M JigarM

🏠
Working from home
View GitHub Profile
@JigarM
JigarM / gistFile.m
Last active August 29, 2015 14:11
Send Data from ViewController to ContainerViewController through Segue's Identifier
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"NextVC"]) {
self.value = 1;
ViewController *controller = [segue destinationViewController];
controller.data = self.value;
}
}
// In NextViewController.h
@property (nonatomic, strong) NSDictionary *data;
@JigarM
JigarM / filegist.m
Created December 17, 2014 18:02
The Action button on the Navigation bar gets tinted by default. This is a hack to go to its original colours.
self.buttonLike.image = [[UIImage imageNamed:@"button-like"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];
//https://gist.github.com/MengTo/7887303
@JigarM
JigarM / FirstWay.m
Last active August 29, 2015 14:11
How to lift up the UIView when UITextField is editing ?
//Original Blog Post : http://technopote.com/lift-uiview-uitextfield-editing/
//Controller.h
@interface Controller : UIViewController <UITextFieldDelegate> {
CGFloat animatedDistance;
}
//Controller.m
#pragma constant UITextField
static const CGFloat KEYBOARD_ANIMATION_DURATION = 0.3;
@JigarM
JigarM / gistFile1.h
Last active August 29, 2015 14:12
Rounded Only three Corners of a UIView
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIView *profile; //(264, 134, 100, 100)
@property (weak, nonatomic) IBOutlet UIView *subview; //(0, 5, 95, 95) : This view added in profile view
@end
@JigarM
JigarM / UIView+UIView_Roundify.h
Created December 30, 2014 00:56
UIView Category for Round Corner of UIView
//
// UIView+UIView_Roundify.h
// JMCurvedView
//
// Created by Mobmaxime on 30/12/14.
// Copyright (c) 2014 Jigar. All rights reserved.
//
//==========================================================================
//Round two corners in UIView
@JigarM
JigarM / controller.m
Created January 2, 2015 12:26
Load Nib into UIScrollView
//Original Post : https://gist.github.com/joshdholtz/1861072
NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"AddNewProductScrollView" owner:self options:nil];
UIView *myView = [nibContents objectAtIndex:0];
[scrollView addSubview: myView];
[scrollView setContentSize:CGSizeMake(myView.frame.size.width, myView.frame.size.height)];
@JigarM
JigarM / Annotations.m
Created January 5, 2015 06:56
Zooms out a MKMapView to enclose all its annotations (inc. current location)
//Original gist : https://gist.github.com/andrewgleave/915374
-(void)MKMapViewFitAnnotations {
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in self.mkmapview.annotations) {
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
//MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0);
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0.1, 0.1);
if (MKMapRectIsNull(zoomRect)) {
zoomRect = pointRect;
@JigarM
JigarM / AMPNavigationBar.m
Last active August 29, 2015 14:13
Darker iOS7 translucent UINavigationBar
//Original Post : https://gist.github.com/aprato/6631390
// .h
@interface AMPNavigationBar : UINavigationBar
@property (nonatomic, assign) CGFloat extraColorLayerOpacity UI_APPEARANCE_SELECTOR;
@end
@JigarM
JigarM / ProfileView.h
Last active August 29, 2015 14:13
Loading a custom UIView class with a custom nib file.
//
// ProfileView.h
// Jigar
//
// Created by Jigar on 31/12/14.
// Copyright (c) 2014 Jigar. All rights reserved.
//
#import <UIKit/UIKit.h>
//https://gist.github.com/gimenete/53704124583b5df3b407 : Originsl gist
- (void)changeRootViewController:(UIViewController*)viewController {
if (!self.window.rootViewController) {
self.window.rootViewController = viewController;
return;
}
UIView *snapShot = [self.window snapshotViewAfterScreenUpdates:YES];
[viewController.view addSubview:snapShot];
self.window.rootViewController = viewController;