1. Removing the view's child view
2. Custom View (UIView)
3. Handle hover window (similar video), equal to zoom
Removes the view's child view
[[Self.viewsubviews]makeobjectsperformselector: @selector (Removefromsuperview)];
Or
Nsarray *viewstoremove = [Self.view subviews];
For (UIView *v in Viewstoremove) {
[v Removefromsuperview];
}
Custom View (UIView)
FACEVIEW.M file
@implementation Faceview
-(ID) initWithFrame: (CGRect) frame{
Self=[super Initwithframe:frame];
if (self) {
}
return self;
}
Self-implementation of the DrawRect method redraw, or can not implement the method, its own definition of execution interface processing method execution
-(void) DrawRect: (cgrect) rect{//Omit implementation ...
} @end
Handle suspended Windows (similar to video), zoom
The view that will be loaded is placed on the main window or on the root view controller, using transform to zoom
The following is a view that is processed in appdelegate
Floatingview *view=[[floatingview Alloc] Initwithframe:cgrectmake (50, 50, 200, 200)];
// Add a drag gesture to make the view drag in the hover window
Uipangesturerecognizer *pangestures=[[uipangesturerecognizer Alloc] initwithtarget:self action: @selector ( Handlepangestures:)];
[View Addgesturerecognizer:pangestures];
//Click View gestures
UITapGestureRecognizer *tapgestures=[[uitapgesturerecognizer Alloc] initwithtarget:self action: @selector ( Narrowview:)];
[View Addgesturerecognizer:tapgestures];
[Self.window Addsubview:view];
Click Equal to zoom Out view
-(void) Narrowview: (UITapGestureRecognizer *) sender{
//Equal ratio zoom view
Sender.view.transform=cgaffinetransformscale (Sender.view.transform, 0.5, 0.5);
}
Handling Video View Drag events
-(void) Handlepangestures: (Uipangesturerecognizer *) sender{
if (sender.state!=uigesturerecognizerstateended&&sender.state!=uigesturerecognizerstatefailed) {
//Use the Locationinview method to get the coordinates of the gesture
Cgpoint Location=[sender LocationInView:sender.view.superview];
Sender.view.center=location;
}
}
IOS, view-related