This file contains hidden or 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)resizeToFitSubviews:(UIView *)view | |
{ | |
float w, h; | |
for (UIView *v in view.subviews) { | |
float fw = v.frame.origin.x + v.frame.size.width; | |
float fh = v.frame.origin.y + v.frame.size.height; | |
w = MAX(fw, w); | |
h = MAX(fh, h); | |
} |
This file contains hidden or 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
- (NSString *)mostCommonCharacter:(NSString *)string | |
{ | |
__block NSMutableArray *charIndex = [[NSMutableArray alloc] init]; | |
// Enumerate | |
[string enumerateSubstringsInRange:NSMakeRange(0, string.length) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) | |
{ | |
[charIndex addObject:substring]; | |
}]; | |
This file contains hidden or 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)customKeyboardOnSearchBar:(UISearchBar *)searchBar | |
{ | |
for(UIView *subView in searchBar.subviews) { | |
if([subView conformsToProtocol:@protocol(UITextInputTraits)]) { | |
[(UITextField *)subView setKeyboardAppearance:UIKeyboardAppearanceAlert]; | |
[(UITextField *)subView setReturnKeyType:UIReturnKeyDone]; | |
} else { | |
for(UIView *subSubView in [subView subviews]) { | |
if([subSubView conformsToProtocol:@protocol(UITextInputTraits)]) { | |
[(UITextField *)subSubView setReturnKeyType:UIReturnKeyDone]; |
NewerOlder