2015/10/2 iOS Notes details

Source: Internet
Author: User

One, the button can not interact in several cases

1,alpha <= 0.01 (0.02 will be able to order)

2,hidden = YES

3, userinteraction = NO

4, where the parent view does not allow interaction, and the button cannot interact

5, you can interact within the visible range of the parent view, and parts beyond the scope cannot interact.

Second, the Uiimageview does not allow user interaction by default.

Third, disorderly order

-(void) randomoptions

{

The option array is out of order

[Self.options Sortedarrayusingcomparator:^nscomparisonresult (NSString *str1, NSString *str2) {

int seed = Arc4random_uniform (2);

if (seed) {

return [str1 COMPARE:STR2];

} else {

return [str2 COMPARE:STR1];

}

}];

}

Four, the model in order to disorderly, only in the time of loading to do a disorderly sequence.

-(Instancetype) Initwithdict: (Nsdictionary *) dict

{

if (self = [super init]) {

[Self setvaluesforkeyswithdictionary:dict];

Random Order of the alternate button, only one order at time of loading

[Self randomoptions];

}

return self;

}

Disorderly ordering outside of the model, each call will be a random order.

[Question Randomoptions];

V. Add masks

-(UIButton *) cover

{

if (_cover = = nil) {

Add Masks (Matte)

_cover = [[UIButton alloc] initWithFrame:self.view.bounds];

_cover.backgroundcolor = [Uicolor colorwithwhite:0.0 alpha:0.5];

[Self.view Addsubview:_cover];

[_cover addtarget:self Action: @selector (bigimage:) forcontrolevents:uicontroleventtouchupinside];

}

return _cover;

}

Add Masks (Matte)

UIButton *cover = [[UIButton alloc] initWithFrame:self.view.bounds];

//

Cover.backgroundcolor = [Uicolor colorwithwhite:0.0 alpha:0.5];

//

[Self.view Addsubview:cover];

//

[Cover addtarget:self action: @selector (smallimage:) forcontrolevents:uicontroleventtouchupinside];

}

Get the image in front of the mask

Bringsubviewtofront the child View Front

[Self.view BringSubviewToFront:self.iconButton];

Set the blur level of a mask

Self.cover.alpha = 0.0;

Self.cover.alpha = 1.0;

Vi. changing the color of the status bar

/**

* Adjust status bar color

Uistatusbarstyledefault = 0,//Dark content, for use in light backgrounds

Uistatusbarstylelightcontent Ns_enum_available_ios (7_0) = 1,//light content, for use on dark backgrounds

*/

-(Uistatusbarstyle) Preferredstatusbarstyle

{

return uistatusbarstylelightcontent;

}

Seven, wait some time to enter a method

[Self performselector: @selector (nextquestion:) Withobject:nil afterdelay:0.5];

Eight, TextField set the word limit

-(BOOL) TextField: (Uitextfield *) TextField Shouldchangecharactersinrange: (nsrange) range replacementstring: ( NSString *) string

{

int loc = Range.location;

Return (Loc < 6);

}

2015/10/2 iOS Notes details

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.