Skip to content

Commit

Permalink
dev:完成退出登录功能,下面继续开发设置页面
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyufeng1991 committed Nov 17, 2015
1 parent ab29f9b commit ac720fc
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 10 deletions.
8 changes: 7 additions & 1 deletion Oncenote.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
719AF3A51BFA306B009D602D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 719AF3A41BFA306B009D602D /* CoreGraphics.framework */; };
719AF3A71BFA3081009D602D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 719AF3A61BFA3081009D602D /* UIKit.framework */; };
719AF3A91BFA308F009D602D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 719AF3A81BFA308F009D602D /* Foundation.framework */; };
719AF3BA1BFB0440009D602D /* SettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 719AF3B91BFB0440009D602D /* SettingViewController.m */; settings = {ASSET_TAGS = (); }; };
71A793751BF5B5F000410FFC /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71A793741BF5B5F000410FFC /* LoginViewController.m */; settings = {ASSET_TAGS = (); }; };
71A793781BF5CDCA00410FFC /* RegisterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71A793771BF5CDCA00410FFC /* RegisterViewController.m */; settings = {ASSET_TAGS = (); }; };
71A7937C1BF5E75600410FFC /* BmobOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 71A7937B1BF5E75600410FFC /* BmobOperation.m */; settings = {ASSET_TAGS = (); }; };
Expand Down Expand Up @@ -155,6 +156,8 @@
719AF3A41BFA306B009D602D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
719AF3A61BFA3081009D602D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
719AF3A81BFA308F009D602D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
719AF3B81BFB0440009D602D /* SettingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingViewController.h; sourceTree = "<group>"; };
719AF3B91BFB0440009D602D /* SettingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingViewController.m; sourceTree = "<group>"; };
71A793731BF5B5F000410FFC /* LoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginViewController.h; sourceTree = "<group>"; };
71A793741BF5B5F000410FFC /* LoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewController.m; sourceTree = "<group>"; };
71A793761BF5CDCA00410FFC /* RegisterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -377,16 +380,18 @@
71A793741BF5B5F000410FFC /* LoginViewController.m */,
71A793761BF5CDCA00410FFC /* RegisterViewController.h */,
71A793771BF5CDCA00410FFC /* RegisterViewController.m */,
717902EE1BF48FC100428756 /* MainViewController.h */,
717902EF1BF48FC100428756 /* MainViewController.m */,
718FF3A11BF623B7009A3F6D /* AddNoteViewController.h */,
718FF3A21BF623B7009A3F6D /* AddNoteViewController.m */,
717902EE1BF48FC100428756 /* MainViewController.h */,
71BEC27F1BF753080003F173 /* NoteDetailViewController.h */,
71BEC2801BF753080003F173 /* NoteDetailViewController.m */,
71BEC2821BF76C6F0003F173 /* AllNotesViewController.h */,
71BEC2831BF76C6F0003F173 /* AllNotesViewController.m */,
71BEC2851BF8485D0003F173 /* AllNoteDetailViewController.h */,
71BEC2861BF8485D0003F173 /* AllNoteDetailViewController.m */,
719AF3B81BFB0440009D602D /* SettingViewController.h */,
719AF3B91BFB0440009D602D /* SettingViewController.m */,
);
name = ViewController;
sourceTree = "<group>";
Expand Down Expand Up @@ -699,6 +704,7 @@
71BEC28A1BF8BC100003F173 /* LaunchScreenViewController.m in Sources */,
718FF3A71BF63687009A3F6D /* Constant.m in Sources */,
71BEC28E1BF8C7830003F173 /* AllUtils.m in Sources */,
719AF3BA1BFB0440009D602D /* SettingViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
86 changes: 86 additions & 0 deletions Oncenote/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,92 @@
</objects>
<point key="canvasLocation" x="1118" y="767"/>
</scene>
<!--Setting View Controller-->
<scene sceneID="pnQ-Ge-gbf">
<objects>
<viewController storyboardIdentifier="SettingViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="uPh-2i-OcR" customClass="SettingViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="fkZ-nf-VMx">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" id="ggs-WB-leo">
<rect key="frame" x="0.0" y="0.0" width="320" height="65"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="YHY-cw-RqO">
<rect key="frame" x="13" y="25" width="40" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="关闭">
<color key="titleColor" red="0.0" green="0.52941176469999995" blue="0.25882352939999997" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="naviCloseButtonPressed:" destination="uPh-2i-OcR" eventType="touchUpInside" id="fcG-E8-qSg"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="设置" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4Tu-Ud-aUM">
<rect key="frame" x="129" y="29" width="62" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="bFD-UH-v4e">
<rect key="frame" x="248" y="25" width="64" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="退出登录">
<color key="titleColor" red="0.0" green="0.52941176469999995" blue="0.25882352939999997" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="naviLogoutButtonPressed:" destination="uPh-2i-OcR" eventType="touchUpInside" id="g4A-Rs-sQm"/>
<action selector="naviStoreButtonPressed:" destination="TeH-OH-vUw" eventType="touchUpInside" id="VbZ-S0-0Hv"/>
</connections>
</button>
</subviews>
<animations/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
</view>
<view contentMode="scaleToFill" id="YU9-qc-lEg">
<rect key="frame" x="-271" y="65" width="1000" height="1"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" red="0.89019607840000003" green="0.89019607840000003" blue="0.89019607840000003" alpha="1" colorSpace="calibratedRGB"/>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="40P-a1-PyT">
<rect key="frame" x="0.0" y="66" width="320" height="395"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SettingCell" id="tO5-T5-vak">
<rect key="frame" x="0.0" y="28" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="tO5-T5-vak" id="AwR-yA-ffL">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</prototypes>
<sections/>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803915" alpha="1" colorSpace="calibratedRGB"/>
</view>
<connections>
<outlet property="settingTableView" destination="40P-a1-PyT" id="Rgm-Ho-i0O"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="xwT-xj-IUw" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1922" y="820"/>
</scene>
<!--Note Detail View Controller-->
<scene sceneID="5o2-xh-LTC">
<objects>
Expand Down
4 changes: 0 additions & 4 deletions Oncenote/LoginViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ - (IBAction)loginButtonPressed:(id)sender {
[BmobUser loginWithUsernameInBackground:username password:password block:^(BmobUser *user, NSError *error) {
if (error) {
//错误处理

[AllUtils showPromptDialog:@"提示" andMessage:@"登录失败,请输入正确的手机号和密码" OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self];




}else{

//给全局变量设值;
Expand Down
10 changes: 5 additions & 5 deletions Oncenote/MainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#import "AllNotesViewController.h"
#import "Constant.h"
#import "AllUtils.h"
#import "SettingViewController.h"

@interface MainViewController ()<UITableViewDataSource,UITableViewDelegate>

Expand Down Expand Up @@ -71,11 +72,10 @@ - (void)viewDidLoad {
//点击导航栏左侧的设置按钮;
- (void)naviSettingButtonPressed:(id)sender{

[AllUtils showPromptDialog:@"提示" andMessage:@"这里是提示信息" OKButton:@"确定" OKButtonAction:^(UIAlertAction *action) {
NSLog(@"点击确定按钮");
} cancelButton:@"取消" cancelButtonAction:^(UIAlertAction *action) {
NSLog(@"点击取消按钮");
} contextViewController:self];

UIViewController *settingViewController = [[UIViewController alloc] init];
settingViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SettingViewController"];
[self presentViewController:settingViewController animated:true completion:nil];


}
Expand Down
13 changes: 13 additions & 0 deletions Oncenote/SettingViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// SettingViewController.h
// Oncenote
//
// Created by chenyufeng on 15/11/17.
// Copyright © 2015年 chenyufengweb. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface SettingViewController : UIViewController

@end
93 changes: 93 additions & 0 deletions Oncenote/SettingViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
//
// SettingViewController.m
// Oncenote
//
// Created by chenyufeng on 15/11/17.
// Copyright © 2015年 chenyufengweb. All rights reserved.
//

#import "SettingViewController.h"
#import "MainViewController.h"
#import "LoginViewController.h"
#import "AllUtils.h"

@interface SettingViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *settingTableView;





@end

@implementation SettingViewController

- (void)viewDidLoad {
[super viewDidLoad];

}


#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

return 5;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

return nil;
}


#pragma mark - 所有按钮的点击操作

- (IBAction)naviCloseButtonPressed:(id)sender {

UIViewController *mainViewController = [[UIViewController alloc] init];
mainViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MainViewController"];
[self presentViewController:mainViewController animated:true completion:nil];


}

//退出登录按钮
- (IBAction)naviLogoutButtonPressed:(id)sender {


[AllUtils showPromptDialog:@"提示" andMessage:@"你真的要退出朝夕笔记吗?" OKButton:@"确定" OKButtonAction:^(UIAlertAction *action) {

//把用户名和密码设为nil;
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:nil forKey:@"username"];
[userDefaults setObject:nil forKey:@"password"];

//同时跳转到登录界面;
UIViewController *loginViewController = [[UIViewController alloc] init];
loginViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
[self presentViewController:loginViewController animated:true completion:nil];


} cancelButton:@"取消" cancelButtonAction:^(UIAlertAction *action) {

} contextViewController:self];













}



@end

0 comments on commit ac720fc

Please sign in to comment.