This set of replacements is implemented in "uiview+ animation" (replacing Uiactionsheet with UIView)
The interface levels are as follows:
First layer: view (this layer fills the entire screen, the color is transparent when initialized,userinteractionenabled is no; the color is black when it is displayed, the alpha value is set to 0.6, Userinteractionenabled is yes. The effect is to obscure other controls on the interface. )
Second layer: Contentview (this layer is used to replace the original uiactionsheet. Uipickerview is added on this layer, the color is white, the alpha value is set to 0.9)
Layer Three: Uipickerview
The core code is as follows:
-(void) showpickerview{ self.userinteractionenabled = YES; [UIView animatewithduration:0.3 delay:0.0 options:uiviewanimationoptioncurveeaseinout animations:^ (void) { Self.backgroundcolor = [Uicolor colorwithred:0 green:0 blue:0 alpha:0.6]; [Self.contentview setframe:cgrectmake (0, Screen_size.height-picker.frame.size.height, 320, Picker.frame.size.height)]; } completion:^ (BOOL isfinished) { }];} -(void) hidepickerview{ [UIView animatewithduration:0.3 delay:0.0 Options:uiviewanimationoptioncurveeaseinout animations:^ (void) { Self.backgroundcolor = [Uicolor clearcolor]; [Self.contentview setframe:cgrectmake (0, Screen_size.height, Screen_size.width, Screen_size.height)]; } completion:^ (BOOL isfinished) { self.userinteractionenabled = NO; }];}
Note:
1. Self in the above code is the first layer of view.
2. It is best to encapsulate this function as a class, so that it can be used directly in multiple places.
Add Uipickerview iOS8 replacement scheme on Uiactionsheet