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 KSCenteredTextView : UITextView | |
@end | |
#import "KSCenteredTextView.h" | |
@implementation KSCenteredTextView |
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
- (UIView*)viewForLeftSidebar { | |
if (!_sampleViewController) { | |
_sampleViewController = [[UISampleViewController alloc] init]; | |
CGRect viewFrame = self.navigationController.applicationViewFrame; | |
_sampleViewController.delegate = self; | |
_sampleViewController.view.frame = CGRectMake(0, viewFrame.origin.y, kSidebarWidth, viewFrame.size.height); | |
_sampleViewController.view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight; | |
} | |
return _sampleViewController; | |
} |
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
// Allows the loading UI to display | |
showLoadingHUD(self.view); | |
[self performBlock:^(void) { | |
// code executed after delay | |
hideLoadingHUD(self.view); | |
} afterDelay:0]; |
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 "NSObject+PWObject.h" | |
@implementation NSObject (PWObject) | |
- (void)performBlock:(void (^)(void))block afterDelay:(NSTimeInterval)delay { | |
int64_t delta = (int64_t)(1.0e9 * delay); | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delta), dispatch_get_main_queue(), block); | |
} | |
@end |
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 "NSObject+PWObject.h" | |
@implementation NSObject (PWObject) | |
- (void)performBlock:(void (^)(void))block afterDelay:(NSTimeInterval)delay { | |
int64_t delta = (int64_t)(1.0e9 * delay); | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delta), dispatch_get_main_queue(), block); | |
} | |
@end |
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
RestResponse response = RestDroid.Post(SERVER + "/people", | |
"person[fname]=Barbados", "person[lname]=Slim", "person[age]=42"); | |
if (!response.error && response.statusCode == 201) { | |
// Use the response | |
} |