IOS, IOS 8
Settings and help
Change profile picture, Change Password, mobile customer service, help, statement, about us.
Code
//// IndexSetting600ViewController.h// SymptomChecker//// Created by wang on 2015-7-21.////#import "CYTableViewController.h"@interface IndexSetting600ViewController : CYTableViewController@end
/// IndexSetting600ViewController. m // SymptomChecker /// Created by wang on 2015-7-21. //// # import "IndexSetting600ViewController. h "# import" UserCenter600Item. h "# import" UserInfoEditingItem. h "// modify the Avatar # import" PortraitPickerViewController. h "// photo view # import" ModifyPasswordViewController. h "// Change Password # import" LocalPasswordViewController. h "# import" CYWebFromLocalViewController. h "// help/Declaration # import" CYAboutUsViewController. h "// about us # define kViewRadio viewWidth ()/320 @ interface IndexSetting600ViewController () <strong> @ end @ implementation IndexSetting600ViewController {UserFigureEditingItem * _ figureItem; // modify the profile * _ PortraitPickerViewController; // modify the profile view Setting600Item * _ changeSecret; // modify the logon password Setting600Item * _ chunyuTel; // mobile customer service Setting600Item * _ helpItem; // help Setting600Item * _ shengMing; // declare Setting600Item * _ aboutUs; // For details about Setting600SeparateItem * _ separateItem; // blank split cell FilledColorButton * _ logoutButton; // deregister button UIView * _ logoutFooterView;}-(id) initWithQuery :( NSDictionary *) query {self = [super initWithQuery: query]; if (self) {self. title = @ "Settings and help"; [[NSNotificationCenter defacenter center] addObserver: self selector: @ selector (createModel) name: kRegisterLocalPassword object: nil];} return self ;} -(void) dealloc {[[nsnotifcenter center defaultCenter] removeObserver: self];}-(void) viewDidLoad {[super viewDidLoad]; [self. tableView setSeparatorStyle: Custom]; [self createTableItems]; // ensure that the item has been created}-(void) viewWillAppear :( BOOL) animated {[super viewWillAppear: animated];} //// create once only //-(void) createTableItems {CY_DEFINE_SELF_BAR (self); User * user = [User currentUser]; // modify the Avatar _ figureItem = [[UserFigureEditingItem alloc] initWithTitle: @ "Avatar" value: [user. matPhoto getMediaUrl]; [self. tableViewActions attachToObject: _ figureItem tapBlock: ^ BOOL (id object, id target, NSIndexPath * indexPath) {[_ self editUserFigure]; return YES;}]; // change the logon password _ changeSecret = [[Setting600Item alloc] initWithTitle: @ "Change logon password"]; _ changeSecret. type = kSetting600Top; [self. tableViewActions attachToObject: _ changeSecret tapBlock: ^ BOOL (id object, id target, NSIndexPath * indexPath) {ModifyPasswordViewController * controller = [ModifyPasswordViewController new]; [_ self cyPresentViewController: controller animated: YES]; return NO;}]; // mobile customer service _ chunyuTel = [[Setting600Item alloc] initWithTitle: @ "mobile customer service"]; _ chunyuTel. type = kSetting600Middle; [self. tableViewActions attachToObject: _ chunyuTel tapBlock: ^ BOOL (id object, id target, NSIndexPath * indexPath) {NSString * feedBackPhoneNumber = @ "4001100866"; [[UIApplication sharedApplication] openURL: [NSURL URLWithString: [NSString stringWithFormat: @ "tel: // % @", feedBackPhoneNumber]; return YES;}]; // help _ helpItem = [[Setting600Item alloc] initWithTitle: @ "help"]; _ helpItem. type = kSetting600Middle; [self. tableViewActions attachToObject: _ helpItem tapBlock: ^ BOOL (id object, id target, NSIndexPath * indexPath) {CYWebFromLocalViewController * controller = [[CYWebFromLocalViewController alloc] initWithQuery :@{@ "title ": @ "help", @ "local_name": @ "help"}]; [self. navigationController pushViewController: controller animated: YES]; return YES;}]; // declaration _ shengMing = [[Setting600Item alloc] initWithTitle: @ "Declaration"]; _ shengMing. type = kSetting600Middle; [self. tableViewActions attachToObject: _ shengMing tapBlock: ^ BOOL (id object, id target, NSIndexPath * indexPath) {CYWebFromLocalViewController * controller = [[CYWebFromLocalViewController alloc] initWithQuery :@{@ "title ": @ "Declaration", @ "local_name": @ "statement"}]; [self. navigationController pushViewController: controller animated: YES]; return YES;}]; // about our _ aboutUs = [[Setting600Item alloc] initWithTitle: @ "About Us"]; _ aboutUs. type = kSetting600Bottom; [self. tableViewActions attachToObject: _ aboutUs tapBlock: ^ BOOL (id object, id target, NSIndexPath * indexPath) {CYAboutUsViewController * controller = [[CYAboutUsViewController alloc] initWithQuery :@{@ "title ": @ "about Us", @ "local_name": @ "about"}]; [self. navigationController pushViewController: controller animated: YES]; return YES;}]; // Split _ separateItem = [[Setting600SeparateItem alloc] init]; // bottom view _ logoutFooterView = [UIView viewWithFrame: CGRectMake (0, 0, self. view. width, 92 * kViewRadio) andBkColor: [UIColor clearColor]; self. tableView. tableFooterView = _ logoutFooterView; // version information UILabel * versionLabel = [UILabel labels: CGRectMake (0, 8 * kViewRadio, viewWidth (), 12 * kViewRadio) fontSize: 11 fontColor: RGBCOLOR_HEX (0x522121) text: [NSString stringWithFormat: @ "current version: % @", @ "1.0.0"]; [versionLabel setTextAlignment: Unknown]; [_ logoutFooterView addSubview: versionLabel]; CGRect logoutRect = CGRectMake (16 * kViewRadio, versionLabel. bottom + 16 * kViewRadio, viewWidth ()-32 * kViewRadio, 44 * kViewRadio); // Logout button _ logoutButton = [[FilledColorButton alloc] initWithFrame: logoutRect color: Compile (0xe85454) highlightedColor: RGBCOLOR_HEX (0xa43939) textColor: [UIColor whiteColor] title: @ "" fontSize: 16 * kViewRadio isBold: YES]; [_ logoutButton addTarget: self action: @ selector (outputs :) forControlEvents: outputs]; [_ logoutFooterView addSubview: _ logoutButton] ;}- (void) editUserFigure {_ blank = [[portraitPickerViewController alloc] initWithParent: self]; _ portraitPickerViewController. delegate = self; [_ portraitPickerViewController showOptions];}-(void) createModel {NSArray * dataItems; if ([User hasLoggedIn]) {dataItems = @ [_ separateItem, _ figureItem, // modify the Avatar _ separateItem, _ changeSecret, // modify the logon password _ chunyuTel, // mobile customer service _ helpItem, // help _ shengMing, // declare _ aboutUs, // about our _ separateItem];} else {_ logoutButton. hidden = YES; _ logoutFooterView. height = 40; dataItems = @ [_ separateItem, _ chunyuTel, // mobile customer service _ helpItem, // help _ shengMing, // declare _ aboutUs, // about our _ separateItem];} self. tableViewModel = [[NITableViewModel alloc] initWithListArray: dataItems delegate: self. cellFactory] ;}# pragma mark-btn-selectors // click logout-(void) onLogOutBtnpressed :( UIButton *) sender {NIDPRINTMETHODNAME (); // log out [[AutoLoginManager sharedInstance] logout]; // update the current interface [self createModel]; [self backToLastController: nil]; // change the UI [[nsicationcenter center defacenter center] postNotificationName: kNotificationUserLogout object: nil] elsewhere; // obtain the unregistered badge [[[nsicationicationcenter defacenter center] postNotificationName: knotifcheccheckbadge object: nil];} @ end
Effect
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.