iOS grows daily once (Day 2)

Source: Internet
Author: User

Then come down to simply say the label (equivalent to Android TextView) and the use of the button, because all is consistent with the appdelegate of the previous article, so this one said Viewcontroller and xib use of Bai.

BIDViewController.h

 #import <UIKit/UIKit.h>@interface bidviewcontroller:uiviewcontroller //     The start of the class @ property (weak, nonatomic) iboutlet UILabel *statuslabel; 
// A. @property is the keyword that defines the attribute; 0 X0 x2222 , the content is the same, the new object retain is 1 , the old object has no change; Retain to another nsstring, the address is the same (create a pointer, pointer copy), the contents of course the same, the object's retain value +1 Span style= "Color:rgb (0, 0, 0); > That is, retain is a pointer copy and copy is a copy of the content.
Iboutlet is just a token that is used to indicate that the implementation has been defined in Xib, xib the CTRL key when connected, the mouse from the file ' s owner is dragged to the space marked with Iboutlet in the code and then selected in the Popup box -(ibaction) buttonpressed: (UIButton *) sender;    // define the function triggered by the operation, Ibaction is also an identity, marking this is the trigger function, xib in the need to trigger the function on the control key, the mouse from the control to drag the key to file ' s owner and select the appropriate function @end    // End of Class

Bidviewcontroller.m

#import "BIDViewController.h"@implementationBidviewcontroller@synthesizeStatuslabel;//appear in pairs with the property in general-(Ibaction) buttonpressed: (UIButton *) Sender {NSString*title = [Sender titleforstate:uicontrolstatenormal];//returns the title of the specified state of the control keyNSString *plaintext = [NSString stringWithFormat:@"%@ button pressed.", title];//%@ represents this parameter when the object type    /** * Make some text color method **/nsmutableattributedstring*styledtext =[[Nsmutableattributedstring alloc] initwithstring:plaintext];    //This syntax is a bit like json wow Nsdictionary*attributes =@{nsfontattributename: [Uifont boldSystemFontOfSize:statusLabel.font.pointSize]}; Nsrange Namerange=[plaintext Rangeofstring:title];    [Styledtext setattributes:attributes Range:namerange]; Statuslabel.attributedtext=Styledtext;}@end


End of the second article!!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.