LTBounceSheetDemo (like logout), how to log out on QQ
Click anywhere:
Click "cancel" or "exit:
Engineering Drawing:
Code:
RootViewController. h
# Import <UIKit/UIKit. h> // Add the header file # import "LTBounceSheet. h "// define file # define color [UIColor colorWithRed: 0/255. 0 green: 175/255. 0 blue: 240/255. 0 alpha: 1] @ interface RootViewController: UIViewController {UIView * backView; LTBounceSheet * sheet;} @ end
RootViewControlle. rm
// Click anywhere. The sheet-(void) touchesBegan :( NSSet *) touches withEvent :( UIEvent *) event {// sheet = [[LTBounceSheet alloc] initWithHeight: 250 bgColor: [UIColor whiteColor]; sheet. alpha = 1; // The background backView = [[UIView alloc] initWithFrame: CGRectMake (0, 0,320,600)]; backView. alpha = 0.3; backView. backgroundColor = [UIColor blackColor]; [self. view addSubview: backView]; // The UITextView * QuitTextView = [[UITextView alloc] initWithFrame: CGRectMake (46, 13,233, 38)]; QuitTextView is displayed. text = @ "no historical records will be deleted after exiting. You can still use this account for the next login. "; QuitTextView. textColor = [UIColor grayColor]; QuitTextView. userInteractionEnabled = NO; QuitTextView. textAlignment = align; [sheet addView: QuitTextView]; // exit button UIButton * QuitButton = [[UIButton alloc] initWithFrame: CGRectMake (50, 75,230, 38)]; [QuitButton addTarget: self action: @ selector (doClickQuitButton :) forControlEvents: UIControlEventTouchDown]; [QuitButton setTitle: @ "exit" forState: UIControlStateNormal]; QuitButton. backgroundColor = [UIColor redColor]; [sheet addView: QuitButton]; // cancel the UIButton * CancelButton = [[UIButton alloc] initWithFrame: CGRectMake (50,125,230, 38)]; [CancelButton addTarget: self action: @ selector (doClickCancelButton :) forControlEvents: UIControlEventTouchDown]; [CancelButton setTitle: @ "cancel" forState: UIControlStateNormal]; CancelButton. backgroundColor = [UIColor blueColor]; [sheet addView: CancelButton]; [self. view addSubview: sheet]; [sheet show] ;}# pragma-mark-doClickActions // exit button-(void) doClickQuitButton :( UIButton *) btn {[sheet hide]; [backView setHidden: YES]; // exit Operation} // cancel button-(void) doClickCancelButton :( UIButton *) btn {[sheet hide]; [backView setHidden: YES]; // cancel the operation}