How to change textColor of Cancel button of UISearchBar in iOS7?

I found answers for my own questions. Here is code , add in AppDelegate if you want to change all cancel button. [[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor redColor], UITextAttributeTextColor, [UIColor whiteColor], UITextAttributeTextShadowColor, [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, nil] forState:UIControlStateNormal]; Swift: let attributes = [NSForegroundColorAttributeName : UIColor.red] UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(attributes, for: .normal)

How to sync localized storyboards’ strings after modifying storyboard in Xcode 5

Check out ReMafoX, it’s a Mac app that perfectly solves your problem. It can be easily installed and integrated within your project, watch this video for a detailed walkthrough. Alternatively, if you prefer an open-source CLI tool without a GUI, you can also use BartyCrouch. Install BartyCrouch via Homebrew: brew install bartycrouch Alternatively, install it … Read more

Springs in Auto Layout: Distribute views evenly, with constraints, in Xcode 5

EDIT Note that in iOS 9 this technique will become unnecessary, because a UIStackView will perform distribution automatically. I’ll add another answer explaining how that works. How to Perform Even Distribution Using Autolayout The simplest way to do this in Interface Builder alone (rather than constructing constraints in code) is to use “spacer” views: Position … Read more

Changing cursor color on UISearchBar without changing tintColor

Set your tint color to the color you want the cancel button to be and then use the UIAppearance Protocol to change the tint color on the text field to be the color you wish the cursor to be. Ex: [self.searchBar setTintColor:[UIColor whiteColor]]; [[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor darkGrayColor]];

AFNetworking 2.0 and HTTP Basic Authentication

AFNetworking 2.0 new architecture use serializers for creating requests and parsing responses. In order to set the authorization header, you should first initialize a request operation manager that replaces the AFHTTPClient, create a serializer and then call the dedicated method to set the header. For example you code would become: AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] … Read more

UITextView renders custom font incorrectly in iOS 7

I debugged this issue a little, and it seems to be a bug in the way NSLayoutManager layouts the text. As other answers pointed out, UITextView is build around TextKit since iOS7, and thus uses NSLayoutManager internally to layout text. UILabel uses Core Text to layout text directly. Both eventually use Core Text to render … Read more

Warnings: Misplaced View

In Xcode 5 the position of views on the canvas does not update when constraints are applied. Thus, it is possible to have constraints that specify a different position for the view than you see it in Interface Builder. You can correct this by pressing Command + Option + = or selecting “Update Frames” in … Read more

UISearchBar text color change in iOS 7

In iOS 7 to access Text Field you have to reiterate on level more. Change your code like this for (UIView *subView in self.searchBar.subviews) { for (UIView *secondLevelSubview in subView.subviews){ if ([secondLevelSubview isKindOfClass:[UITextField class]]) { UITextField *searchBarTextField = (UITextField *)secondLevelSubview; //set font color here searchBarTextField.textColor = [UIColor blackColor]; break; } } } Note : This … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)