In the development, now many apps update the new features will give a user a hint, in order to facilitate the user better experience, then how this feature?
First look at the following:
1. First create the first Viewcontroller put a imageview and a button on it
- (void) Viewdidload {[SuperViewdidload];additional setup after loading the view. Uiimageview*imageview=[[UiimageviewAlloc]init]; ImageView. Frame=cgrectmake (0,0, Self. View. Frame. Size. Width, Self. View. Frame. Size. Height); ImageView. Image=[UIImageimagenamed:@"Girl.png"]; [ Self. ViewAddsubview:imageview];UIButton*btn=[[UIButtonAlloc]init]; Btn. Frame=cgrectmake ( -, -, -, -); Btn. BackgroundColor=[UicolorBluecolor]; [Btn AddTarget: SelfAction@selector(Btnclick) forcontrolevents:uicontroleventtouchupinside]; [ImageView ADDSUBVIEW:BTN]; ImageView. userinteractionenabled=YES;} -(void) btnclick{Backviewcontroller *backvc=[[backviewcontroller Alloc]init]; [ SelfPRESENTVIEWCONTROLLER:BACKVC Animated:YESCompletion:Nil];}
2. At this time we create a backviewcontroller setting transparent
-(instancetype) init{self = [super init]; if (self ) {self .view =[uicolor colorwithwhite:0 Alpha:0.4 ]; self .modaltransitionstyle = uimodaltransitionstylecrossdissolve; self .modalpresentationstyle = Uimodalpresentationoverfullscreen; } return self ;}
It is suggested here that many times we set the value of the Alpha property directly on the view to cause its child controls to become translucent, and usually our requirement is that the background is translucent and its child controls opaque.
So we can use the method to set the transparency
//Set only black-and-white background color The parameters that follow white are grayscale, from 0-1 to black, and alpha is the transparency you want to adjust. Blackv. BackgroundColor= [UicolorColorwithwhite:0.F Alpha:0.7];//Set background color for any colorBlackv. BackgroundColor= [UicolorColorwithred:122/255.0Green123/255.0Blue234/255.0Alpha0.7];Uicolor*color = [UicolorBlackcolor];bgview. BackgroundColor= [Color colorwithalphacomponent:0.5];
3. Set the controls above the Backviewcontroller
-(void) viewdidload {[Super Viewdidload];UIButton *btn=[uibutton Buttonwithtype:uibuttontypecustom];Btn. Frame=cgrectmake ( -, -, -, -);Btn. BackgroundColor=[uicolor Bluecolor];[Self. ViewADDSUBVIEW:BTN];[Btn Setbackgroundimage:[uiimage imagenamed:@"Userguidebtnbg_unclear.png"] Forstate:uicontrolstatenormal];[Btn addtarget:self Action: @selector (Btnclick) forcontrolevents:uicontroleventtouchupinside];Btn. BackgroundColor=[uicolor Clearcolor];Btn. Alpha=0.75;UIView *view1=[[uiview Alloc]init];View1. BackgroundColor=[uicolor Blackcolor];View1. Alpha=0.75;[Self. ViewADDSUBVIEW:VIEW1];View1. Frame=cgrectmake (0,0, self. View. Frame. Size. Width, -);UIView *view2=[[uiview Alloc]init];View2. BackgroundColor=[uicolor Blackcolor];View2. Alpha=0.75;[Self. ViewADDSUBVIEW:VIEW2];View2. Frame=cgrectmake (0, -+ -, self. View. Frame. Size. Width, self. View. Frame. Size. Height- -- -);UIView *view3=[[uiview Alloc]init];View3. BackgroundColor=[uicolor Blackcolor];View3. Alpha=0.75;[Self. ViewADDSUBVIEW:VIEW3];View3. Frame=cgrectmake (0, -, -, -);UIView *view4=[[uiview Alloc]init];View4. BackgroundColor=[uicolor Blackcolor];View4. Alpha=0.75;[Self. ViewADDSUBVIEW:VIEW4];View4. Frame=cgrectmake ( -+ -, -, self. View. Frame. Size. Width- -- -, -);UILabel *titlelabel=[[uilabel Alloc]init];Titlelabel. Frame=cgrectmake ( -, -, -, -);[Self. ViewAddsubview:titlelabel];Titlelabel. Text[Email protected]"This is a new feature";Titlelabel. TextColor=[uicolor Whitecolor];}-(void) btnclick{[self dismissviewcontrolleranimated:yes completion:nil];}
The principle is very simple, we present out a transparent controller, so that in the controller put a few depth of Alpha view and a btn, oh, also need a label hint text, you can add some arrows or something, of course, this btn when the artwork buckle after the processing to you, Then you can change their frame to prompt for different positions. Because it is a demo so I use frame, I suggest to use AutoLayout to set the relationship between them, and then use the transform to implement the mobile frame, then you can prompt a number of new features.
BTN the effect after the cutout:
New iOS feature boot tips