Today learned a bit Uilabel Uitextfield UIButton uiimage These basic controls, uilabel nothing to say, because do not involve the exchange of work, remember a few properties on the line.
Uitextfield this thing, encountered a lot of problems. I use XCode7.2, after establishing the empty application (application), Uitextfield no matter how to click No response, With XCode6.3 Open but is normal, later also do not know why sometimes normal and sometimes error, find an afternoon problem or not found, can only first use 6.3 to do.
Speaking of Uitextfield, mainly keyboard type settings, and how to withdraw the keyboard this operation, learned two ways:
1. Implement the Textfieldshouldreturn in the Uitextfielddelegate protocol: method:
1 -(BOOL) Textfieldshouldreturn: (Uitextfield *) TextField2{3 [TextField Resignfirstresponder]; 4 return YES; 5 }
Textfieldshouldreturn: This method refers to the method that is executed when the return key on the keyboard is pressed, and when the TextField that is being entered after the press is dropped, the first responder is withdrawn and the keyboard is recalled.
2. Implementing Touchesbegan:withevent: Methods
This method is found on the Internet, not much to say, directly on the code:
1 -(void) Touchesbegan: (Nsset *) touches withevent: (uievent *)event2{ 3 [Self.window Endediting:yes]; 4 }
The thing that this method probably does is that when it detects that it is pressed on the blank area of the screen, the editing state is ended. I feel this method is more common than the one above.
UIButton main note Systembutton and CustomButton Some small differences, registered events using AddTarget:action:forControlEvents: Method, the first parameter is generally self, The second parameter is the SEL, which is the method name, and the third parameter is how to trigger the button, typically using the UIControlEventTouchUpInside value.
UIImage can be used to make frame animation, and it is important to note that if the image format is PNG, you can not write the extension, other formats must be written, the main steps are as follows:
1. Instantiating Uiimageview objects
Uiimageview *imageview = [[Uiimageview alloc] initwithframe:cgrectmake (100, 100, 100, 100)];
2. Instantiate a variable array to hold the picture of the frame animation
Nsmutablearray *imageviewarray = [[Nsmutablearray alloc] initwithcapacity:0];
3. Traverse the picture, there is a variable group (assuming 10, named "Sprite0~9")
for (int i = 0; i <; i + +)
{
UIImage *image = [UIImage imagenamed:[nsstring stringwithformat:@ "sprite%d", I]];
[Imageviewarray Addobject:image];
}
4. Assigning a frame animation array to ImageView
Imageview.animationimages = Imageviewarray;
You can also set some other properties, including the duration of the animation: animationduration
Number of repetitions: Animationrepeatcount (for 0, always repeating)
================ written in the back =============
Today, a busy day, mainly Xcode that bug let me headache, and also intends to use WordPress to the previous ugly page to do again, do the blog will definitely be transferred to their home page, today wrote a little hasty, mainly written to continue to take WordPress, do not say, go Go
Objective-c Learning record 36th Day