Skip to content

Commit

Permalink
dev:完成分享笔记功能,下面进行设置界面的开发
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyufeng1991 committed Nov 16, 2015
1 parent 6dcae94 commit 74fdcd7
Show file tree
Hide file tree
Showing 11 changed files with 208 additions and 48 deletions.
8 changes: 8 additions & 0 deletions Oncenote.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
715CB76D1BF99B1A0079DB35 /* shareImg.png in Resources */ = {isa = PBXBuildFile; fileRef = 715CB76C1BF99B1A0079DB35 /* shareImg.png */; settings = {ASSET_TAGS = (); }; };
717902EA1BF48FC100428756 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 717902E91BF48FC100428756 /* main.m */; };
717902ED1BF48FC100428756 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 717902EC1BF48FC100428756 /* AppDelegate.m */; };
717902F01BF48FC100428756 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 717902EF1BF48FC100428756 /* MainViewController.m */; };
Expand Down Expand Up @@ -97,6 +98,7 @@
/* Begin PBXFileReference section */
042E519FF0D448E00C6B94EE /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
52A3A8C36BAD439F0DCC8BC9 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
715CB76C1BF99B1A0079DB35 /* shareImg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = shareImg.png; sourceTree = "<group>"; };
717902E51BF48FC100428756 /* Oncenote.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Oncenote.app; sourceTree = BUILT_PRODUCTS_DIR; };
717902E91BF48FC100428756 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
717902EB1BF48FC100428756 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -362,6 +364,7 @@
71A793801BF5E7AD00410FFC /* Resource */ = {
isa = PBXGroup;
children = (
715CB76C1BF99B1A0079DB35 /* shareImg.png */,
717902F41BF48FC100428756 /* Assets.xcassets */,
717902F91BF48FC100428756 /* Info.plist */,
);
Expand Down Expand Up @@ -544,6 +547,7 @@
717902F81BF48FC100428756 /* LaunchScreen.storyboard in Resources */,
717902F51BF48FC100428756 /* Assets.xcassets in Resources */,
717902F31BF48FC100428756 /* Main.storyboard in Resources */,
715CB76D1BF99B1A0079DB35 /* shareImg.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -750,6 +754,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_BITCODE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand Down Expand Up @@ -794,6 +799,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_BITCODE = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand Down Expand Up @@ -875,6 +881,7 @@
baseConfigurationReference = 042E519FF0D448E00C6B94EE /* Pods.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = Oncenote/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.chenyufengweb.Oncenote;
Expand All @@ -887,6 +894,7 @@
baseConfigurationReference = C6D3406A90F2A54E2CBA0100 /* Pods.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = Oncenote/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.chenyufengweb.Oncenote;
Expand Down
25 changes: 10 additions & 15 deletions Oncenote/AddNoteViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#import "Constant.h"
#import "AppDelegate.h"
#import "MainViewController.h"
#import "AllUtils.h"


@interface AddNoteViewController ()

Expand Down Expand Up @@ -41,36 +43,29 @@ - (IBAction)naviStoreButtonPressed:(id)sender {

if (![noteTitle isEqual: @""] && ![noteText isEqual: @""]){

// BmobOperation *operate = [[BmobOperation alloc] init];
// BmobOperation *operate = [[BmobOperation alloc] init];
[BmobOperation addNoteToNoteTable:NOTE_TABLE userId:userId username:username noteTitle:noteTitle noteText:noteText todo:^(BOOL isSuccessful, NSError *error) {
if (isSuccessful) {
[self showPromptDialog:@"提示" andMessage:@"增加一条笔记成功" andButton:@"确定" andAction:^(UIAlertAction *action) {

[AllUtils showPromptDialog:@"提示" andMessage:@"增加一条笔记成功" OKButton:@"确定" OKButtonAction:^(UIAlertAction *action) {
//跳回到主界面;
UIViewController *mainViewController = [[UIViewController alloc] init];
mainViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MainViewController"];
[self presentViewController:mainViewController animated:true completion:nil];
NSLog(@"回到主界面");
}];
} cancelButton:@"" cancelButtonAction:nil contextViewController:self];


}else {
[self showPromptDialog:@"提示" andMessage:@"服务器异常,增加笔记失败" andButton:@"确定" andAction:nil];
[AllUtils showPromptDialog:@"提示" andMessage:@"服务器异常,增加笔记失败" OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self];
}
}];
}else{
[self showPromptDialog:@"提示" andMessage:@"标题和内容缺一不可" andButton:@"确定" andAction:nil];
[AllUtils showPromptDialog:@"提示" andMessage:@"标题和内容缺一不可" OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self];
}

}

#pragma mark - 弹出提示对话框
- (void)showPromptDialog:(NSString*)title andMessage:(NSString*)message andButton:(NSString*)buttonTitle andAction:(void (^ __nullable)(UIAlertAction *action)) handler{

//尝试使用新的弹出对话框;
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:buttonTitle style:UIAlertActionStyleDefault handler:handler]];
//弹出提示框;
[self presentViewController:alertController animated:true completion:nil];
}


@end

Expand Down
46 changes: 45 additions & 1 deletion Oncenote/AllNoteDetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#import "AppDelegate.h"
#import "MainViewController.h"

#import <ShareSDK/ShareSDK.h>
#import <ShareSDKUI/ShareSDK+SSUI.h>
#import "AllUtils.h"

@interface AllNoteDetailViewController ()

@property (weak, nonatomic) IBOutlet UIImageView *backImageView;
Expand All @@ -39,17 +43,57 @@ - (void)viewDidLoad {

//控件绑定操作;
[self.backImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(allNoteDetailBackButtonPressed:)]];
[self.shareImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(allNoteDetailShareButtonPressed:)]];

}


#pragma mark - 所有的按钮点击操作
- (void) allNoteDetailBackButtonPressed:(id)sender{

[self updateBmobObject:NOTE_TABLE noteId:self.noteId noteTitle:self.noteTitleTextField.text noteText:self.noteTextTextView.text];

}

- (void) allNoteDetailShareButtonPressed:(id)sender{

NSArray* imageArray = @[[UIImage imageNamed:@"shareImg.png"]];

if (imageArray) {

NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
[shareParams SSDKSetupShareParamsByText:[NSString stringWithFormat:@"标题:%@\n内容:%@",self.noteTitleTextField.text,self.noteTextTextView.text]
images:nil
url:nil
title:self.noteTitleTextField.text
type:SSDKContentTypeAuto];
[ShareSDK showShareActionSheet:nil
items:nil
shareParams:shareParams
onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {

switch (state) {
case SSDKResponseStateSuccess:
{
[AllUtils showPromptDialog:@"提示" andMessage:@"分享成功" OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self];
break;
}
case SSDKResponseStateFail:
{
[AllUtils showPromptDialog:@"提示" andMessage:[NSString stringWithFormat:@"分享失败:%@",error] OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self];
break;
}
default:
break;
}

}];

}


}

#pragma mark - 修改笔记
-(void)updateBmobObject:(NSString*)tableName noteId:(NSString*)noteId noteTitle:(NSString*)noteTitle noteText:(NSString*)noteText{
//查找GameScore表
Expand Down
3 changes: 3 additions & 0 deletions Oncenote/AllUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface AllUtils : NSObject

+ (NSString *)getDateFromString:(NSString*)date;


+ (UIAlertController*)showPromptDialog:(NSString*)title andMessage:(NSString*)message OKButton:(NSString*)OKButtonTitle OKButtonAction:(void (^)(UIAlertAction *action))OKButtonHandler cancelButton:(NSString*)cancelButtonTitle cancelButtonAction:(void (^)(UIAlertAction *action))cancelButtonHandler contextViewController:(UIViewController*)contextViewController;
@end
31 changes: 31 additions & 0 deletions Oncenote/AllUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,35 @@ + (NSString *)getDateFromString:(NSString*)date{
return str2;
}

#pragma mark - 弹出提示对话框
+ (UIAlertController*)showPromptDialog:(NSString*)title andMessage:(NSString*)message OKButton:(NSString*)OKButtonTitle OKButtonAction:(void (^)(UIAlertAction *action))OKButtonHandler cancelButton:(NSString*)cancelButtonTitle cancelButtonAction:(void (^)(UIAlertAction *action))cancelButtonHandler contextViewController:(UIViewController*)contextViewController{

//尝试使用新的弹出对话框;
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:OKButtonTitle style:UIAlertActionStyleDefault handler:OKButtonHandler]];

if ([cancelButtonTitle isEqualToString:@""]) {
//表示不需要“取消”按钮;
}else{
//需要“取消”按钮;
[alertController addAction:[UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleDefault handler:cancelButtonHandler]];
}

//弹出提示框;
[contextViewController presentViewController:alertController animated:true completion:nil];

return alertController;
}

@end











4 changes: 2 additions & 2 deletions Oncenote/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
authType:SSDKAuthTypeBoth];
break;
case SSDKPlatformTypeWechat:
[appInfo SSDKSetupWeChatByAppId:@"wx4868b35061f87885"
appSecret:@"64020361b8ec4c99936c0e3999a9f249"];
[appInfo SSDKSetupWeChatByAppId:@"wxa7be3ef36352dc5c"
appSecret:@"d4624c36b6795d1d99dcf0547af5443d"];
break;
case SSDKPlatformTypeQQ:
[appInfo SSDKSetupQQByAppId:@"1104897411"
Expand Down
49 changes: 48 additions & 1 deletion Oncenote/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,32 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>mqqOpensdkSSoLogin</string>
<string>mqzone</string>
<string>sinaweibo</string>
<string>alipayauth</string>
<string>alipay</string>
<string>safepay</string>
<string>mqq</string>
<string>mqqapi</string>
<string>mqqopensdkapiV3</string>
<string>mqqopensdkapiV2</string>
<string>mqqapiwallet</string>
<string>mqqwpa</string>
<string>mqqbrowser</string>
<string>wtloginmqq2</string>
<string>weixin</string>
<string>wechat</string>
<string>mqzoneopensdkapiV2</string>
<string>mqzoneopensdkapi19</string>
<string>mqzoneopensdkapi</string>
<string>mqzoneopensdk</string>
<string>qzapp</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>zh_CN</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -18,6 +42,29 @@
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>weixin</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wxa7be3ef36352dc5c</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>qq</string>
<key>CFBundleURLSchemes</key>
<array>
<string>QQ41DB6583</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
20 changes: 7 additions & 13 deletions Oncenote/MainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,23 @@ - (void)viewDidLoad {
#pragma mark - 所有的按钮点击事件
//点击导航栏左侧的设置按钮;
- (void)naviSettingButtonPressed:(id)sender{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"这是设置按钮" preferredStyle: UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//点击按钮的响应事件;
}]];

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

[self presentViewController:alert animated:true completion:nil];

}

- (void)naviRefreshButtonPressed:(id)sender{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"这是刷新按钮" preferredStyle: UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//点击按钮的响应事件;
}]];

[self presentViewController:alert animated:true completion:nil];

}

//点击导航栏搜索按钮;
- (void)naviSearchButtonPressed:(id)sender{

// NSLog(@"点击了搜索按钮");



}
Expand Down
Loading

0 comments on commit 74fdcd7

Please sign in to comment.