CAGradientLayer The CAGradientLayer class is used to draw a color gradient on its background color to fill the entire shape of the layer, including rounded corners. This class inherits from the CALayer class and is very convenient to use. Similar to the gradient processing in Quartz 2D, a gradient has a starting position (startPoint) and an ending position (endPoint). Between these two positions, we can specify a set of color values (colors, elements are CGColorRef objects), which can be two or more, and each color value corresponds to a location (locations). In addition, gradients are divided into axial gradients and radial gradients. Let's write an example to see the specific use of CAGradientLayer:
refer to CAGradientLayer Class Reference Handling Ineligible Devices in Xcode I changed to a new computer, installed Xcode 6.3, created a new certificate and profile, opened Xcode, and connected my phone. But then I found that the device was marked as Ineligible Devices and was not recognized. The situation is similar to the following picture: The computer is trusted, and the certificates and profiles are OK. I tried restarting Xcode and reconnecting the phone several times, but it didn't work. I just can't select the device. *** I selected the device in Product->Destination. But I still can't select it in the toolbar. I'm so frustrated. Please help. User comment: I changed the iOS SDK to iOS 7 and it was available, but then I ignored it. It was available again in iOS 8 SDK for unknown reasons... Hide the cursor of UITextField after iOS 7 After the new project only supports iOS 7, many things become much simpler, just like hiding the cursor of UITextField, with a simple sentence:
Usually when we use UIPickerView as our UITextField's inputView, we need to hide the cursor. Of course, if you want to change the cursor color, you can do the same. There is a legacy problem with this approach: usually when we use UIPickerView as the inputView of UITextField, we don't want to perform various menu operations (select all, copy, paste), but when we just want to set the tintColor of UITextField, we can still perform these operations, so additional processing is required. We can handle this problem like this: in textFieldShouldBeginEditing:, we set the userInteractionEnabled of UITextField to NO, and then in textFieldShouldEndEditing:, set this value back. As follows:
That's it. Of course, this is just one way we are currently using. There are other methods, just google or stackoverflow. Left alignment issue of Chinese text in UIAlertView after iOS 7 Before iOS 7, if we want to display the text in UIAlertView on the left, we can use the following code to handle it:
But unfortunately, after iOS 7, Apple doesn't allow us to do this. When we get the subviews of UIAlertView, we get an empty array and we can't get the label we want. What should we do? Three ways: tell the product manager and UED that this can't be implemented (of course, this will be despised, and people will say you are incompetent); write it yourself; find a third-party open source code. Hehe, but because of the tight schedule recently, I decided to tell them that it can't be implemented, haha. But I found an open source on github, Custom iOS AlertView, with a lot of stars. It looks good, I will study it carefully later. |
<<: 5 Do's and 3 Don'ts in Code Comments
>>: Why did Google and Apple develop their own programming languages?
Social needs are the third need based on physiolo...
2020 was a turbulent year for the film industry. ...
The course comes from the online training course ...
The author has conducted an in-depth analysis of ...
Recommended places for drinking tea and spa in Ni...
【51CTO.com original article】 [51CTO original arti...
Event planning refers to the planning of differen...
Myth: **** “Can you buy equipment to ‘clean your ...
[[163896]] [51CTO.com Quick Translation] Deep Ins...
Review expert: Dong Wenpan, associate professor o...
How many steps are needed to take a stereoscopic ...
The traffic dividend has passed, so how will traf...
For enterprises, innovation is not an easy thing,...
Apple co-founder and former CEO Steve Jobs was kn...
No one likes to watch ads, but everyone needs to ...