Click anywhere:
File directory:
Moreview. h
#import <UIKit/UIKit.h>@interface MoreView : UIView@end
Moreview. m
# Import "moreview. H "@ implementation moreview-(ID) initwithframe :( cgrect) frame {self = [Super initwithframe: frame]; If (Self) {// initialization code // The design background color is red self. backgroundcolor = [uicolor redcolor];} return self ;}
Rootviewcontroller. h
# Import <uikit/uikit. h> // header file # import "moreview. H "@ interface rootviewcontroller: uiviewcontroller {// whether to click bool isswitch; // red uiview page moreview * moreview;} @ end
Rootviewcontroller. m
// Click anywhere to display the red uiview-(void) touchesbegan :( nsset *) touches withevent :( uievent *) event {If (isswitch) {[moreview removefromsuperview]; isswitch = no;} else {moreview = [[moreview alloc] initwithframe: cgrectmake (10,100,200, 50)]; [self. view addsubview: moreview]; isswitch = Yes ;}}
Click anywhere to bring up another interface (travel partner)