Skip to content

Instantly share code, notes, and snippets.

View nscoding's full-sized avatar

Patrick Chamelo nscoding

View GitHub Profile
@nscoding
nscoding / NSString
Created November 26, 2013 16:22
NSString check if the string contains composed characters.
+ (BOOL)stringContainsComposedCharacters:(NSString *)string
{
__block BOOL contains = NO;
[string enumerateSubstringsInRange:NSMakeRange(0, string.length)
options:NSStringEnumerationByComposedCharacterSequences
usingBlock:
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop)
{
if (substringRange.length > 1)
{
@nscoding
nscoding / NSCSearchBar.h
Last active July 6, 2018 04:07
On iOS 7 UISearchBar the placeholder text is centred and I want to disable that and make it always stick to the left like it was before. There is a private method setCenterPlaceholder and calling this with a BOOL work will make the trick. I am wondering if there is any other, not "Hacked" that does the same thing.
@interface NSCodingSearchBar : UISearchBar
// Default by the system is YES.
// https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/UIKit.framework/UISearchBar.h
@property (nonatomic, assign, setter = setHasCentredPlaceholder:) BOOL hasCentredPlaceholder;
@end