This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - UIPickerView Datasource | |
- (int)numberOfComponentsInPickerView:(UIPickerView *)pickerView{ | |
return 1; | |
} | |
- (int)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{ | |
return _clubNameArray.count; | |
} | |
- (NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{ | |
return _clubNameArray[row]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Show actionsheet | |
NSString *actionSheetTitle = @"Add Photo"; //Action Sheet Title | |
NSString *other1 = @"Take Photo"; | |
NSString *other2 = @"Choose from Gallery"; | |
NSString *cancelTitle = @"Cancel"; | |
UIActionSheet *actionSheet = [[UIActionSheet alloc] | |
initWithTitle:actionSheetTitle | |
delegate:self | |
cancelButtonTitle:cancelTitle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface MyTextField : UITextField | |
{ | |
BOOL isEnablePadding; | |
float paddingLeft; | |
float paddingRight; | |
float paddingTop; | |
float paddingBottom; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ViewDidLoad | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardWillShow:) | |
name:UIKeyboardWillShowNotification | |
object:nil]; | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardWillHide:) | |
name:UIKeyboardWillHideNotification | |
object:nil]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Width constraint, half of parent view width | |
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:centerView | |
attribute:NSLayoutAttributeWidth | |
relatedBy:NSLayoutRelationEqual | |
toItem:self.view | |
attribute:NSLayoutAttributeWidth | |
multiplier:0.5 | |
constant:0]]; | |
// Height constraint, half of parent view height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SINGLETON PATTERN | |
-->.h: | |
+ (instancetype)sharedInstance; | |
-->.m: | |
+ (instancetype)sharedInstance | |
{ | |
static MyClass *sharedInstance = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedInstance = [[MyClass alloc] init]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - Process data | |
- (CGFloat) calculateWidthItem{ | |
return ([[UIScreen mainScreen]bounds].size.width -16 - 4*10)/2; | |
} | |
- (CGFloat) calculateHeightItem{ | |
return (([[UIScreen mainScreen]bounds].size.width -16 - 4*10)/2)*1.5; | |
} | |
--> widthItem = [self calculateWidthItem]; | |
heightItem = [self calculateHeightItem]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BASIC | |
MBProgressHUD *hud; | |
hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; | |
hud.mode = MBProgressHUDModeIndeterminate; | |
hud.labelText = @"loading..."; | |
[hud show:YES]; | |
--> [hud hide:YES]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Call ViewController with UINavigationController | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// Override point for customization after application launch. | |
MainVC *vcMain = [[MainVC alloc] initWithNibName:@"MainVC" bundle:nil]; | |
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vcMain]; | |
self.window.rootViewController = nav; | |
nav.navigationBarHidden = YES; | |
return YES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//GET | |
+(void) checkLoginWithUsername:(NSString*)username andPassword:(NSString*)password InBackground:(void(^)(BOOL success)) completionHandler{ | |
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
NSDictionary *para = [NSDictionary dictionaryWithObjectsAndKeys:username, @"email", password, @"password", nil]; | |
[manager setRequestSerializer:[AFHTTPRequestSerializer serializer]]; | |
[manager.requestSerializer setAuthorizationHeaderFieldWithUsername:@"admin" password:@"admin"]; | |
manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"]; | |
[manager GET:@"http://lottofy.gleblu.com/ws/login.php" parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
if ([[responseObject objectForKey:@"success"] doubleValue] == 0) { | |
completionHandler(NO); |
NewerOlder