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
static __inline__ NSRect CenteredRectInRect(NSRect innerRect, NSRect outerRect) | |
{ | |
#if CGFLOAT_IS_DOUBLE | |
innerRect.origin.x = outerRect.origin.x | |
+ floor((outerRect.size.width - innerRect.size.width) / (CGFloat) 2.0); | |
innerRect.origin.y = outerRect.origin.y | |
+ floor((outerRect.size.height - innerRect.size.height) / (CGFloat) 2.0); | |
#else | |
innerRect.origin.x = outerRect.origin.x | |
+ floorf((outerRect.size.width - innerRect.size.width) / (CGFloat) 2.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
-(id) initWithCoder:(NSCoder *)aDecoder { | |
if ((self = [super initWithCoder:aDecoder])) { | |
QRootElement *_root = [[QRootElement alloc] init]; | |
_root.grouped = YES; | |
/* Put your init code here or in viewDidLoad */ | |
self.root = _root; | |
} | |
return self; | |
} |
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
CGRect pageViewRect = self.view.bounds; | |
pageViewRect = CGRectInset(pageViewRect, 40.0, 80.0f); | |
self.pageViewController.view.frame = pageViewRect; |
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
int page = scrollView.contentOffset.x / scrollView.frame.size.width; |
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 PRLabel : UILabel | |
@property (strong, nonatomic, readwrite) UIView* inputView; | |
@property (strong, nonatomic, readwrite) UIView* inputAccessoryView; | |
@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
//Subclass UITextfield and Override the - (CGRect)caretRectForPosition:(UITextPosition *)position //method and return CGRectZero. | |
- (CGRect)caretRectForPosition:(UITextPosition *)position { | |
return CGRectZero; | |
} |
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
- (void)viewDidLoad | |
{ | |
UIDatePicker *datePicker = [[UIDatePicker alloc] init]; | |
datePicker.datePickerMode = UIDatePickerModeDate; | |
UIToolbar *toolbar =[[UIToolbar alloc]initWithFrame:CGRectMake(0,0, self.view.frame.size.width,44)]; | |
toolbar.barStyle =UIBarStyleDefault; | |
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel |
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
[self.tableView beginUpdates]; | |
[self.tableView endUpdates]; |
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
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; | |
refreshControl.tintColor = [UIColor grayColor]; | |
[refreshControl addTarget:self action:@selector(refershControlAction) forControlEvents:UIControlEventValueChanged]; | |
[self.collectionView addSubview:refreshControl]; | |
self.collectionView.alwaysBounceVertical = YES; |