Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added Setting/.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions Setting/Setting.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
TargetAttributes = {
CC9523ED1BADA07D0040FF08 = {
CreatedOnToolsVersion = 7.0;
ProvisioningStyle = Manual;
};
CC9524091BADA07D0040FF08 = {
CreatedOnToolsVersion = 7.0;
Expand All @@ -281,6 +282,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -474,23 +476,29 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Setting/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = zifeng.Setting;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
};
name = Debug;
};
CC9524201BADA07D0040FF08 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Setting/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = zifeng.Setting;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
45 changes: 30 additions & 15 deletions Setting/Setting/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,52 @@
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
15 changes: 14 additions & 1 deletion Setting/Setting/ZFettingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,23 @@ - (void)add1SectionItems {
[weakSelf.navigationController pushViewController:helpVC animated:YES];
};

NSString *weixinStr =@"xxxxxx";
// 开发者微信
ZFSettingItem *weixin = [ZFSettingItem itemWithIcon:@"MoreShare" title:@"开发者微信" type:ZFSettingItemTypeText text:weixinStr];
weixin.operation = ^{
//复制到剪切板
[UIPasteboard generalPasteboard].string = weixinStr;
// 初始化对话框
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"已复制" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]];
// 弹出对话框
[self presentViewController:alert animated:true completion:nil];
};

ZFSettingGroup *group = [[ZFSettingGroup alloc] init];
group.header = @"高级设置";
group.footer = @"这是footer";
group.items = @[ help, share , about];
group.items = @[ help, share , about,weixin];
[_allGroups addObject:group];
}

Expand Down
Binary file added ZFSetting/.DS_Store
Binary file not shown.
Binary file added ZFSetting/Model/.DS_Store
Binary file not shown.
6 changes: 5 additions & 1 deletion ZFSetting/Model/ZFSettingItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
typedef NS_ENUM(NSInteger, ZFSettingItemType) {
ZFSettingItemTypeNone, // 什么也没有
ZFSettingItemTypeArrow, // 箭头
ZFSettingItemTypeSwitch // 开关
ZFSettingItemTypeSwitch, // 开关
ZFSettingItemTypeText //文本
};

@interface ZFSettingItem : NSObject
/// 图标
@property (nonatomic, copy) NSString *icon;
/// 标题
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *text;
/// 设置开关
@property (nonatomic, assign, getter=isSwitchOn) BOOL switchOn;
/// cell的样式
Expand All @@ -31,4 +33,6 @@ typedef NS_ENUM(NSInteger, ZFSettingItemType) {

+ (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title type:(ZFSettingItemType)type;

+ (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title type:(ZFSettingItemType)type text:(NSString *)text;

@end
11 changes: 10 additions & 1 deletion ZFSetting/Model/ZFSettingItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@

@implementation ZFSettingItem

+ (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title type:(ZFSettingItemType)type {
+ (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title type:(ZFSettingItemType)type{
ZFSettingItem *item = [[self alloc] init];
item.icon = icon;
item.title = title;
item.type = type;
return item;
}

+ (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title type:(ZFSettingItemType)type text:(NSString *)text{
ZFSettingItem *item = [[self alloc] init];
item.icon = icon;
item.title = title;
item.type = type;
item.text=text;
return item;
}

@end
Binary file added ZFSetting/View/.DS_Store
Binary file not shown.
18 changes: 14 additions & 4 deletions ZFSetting/View/ZFSettingCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@interface ZFSettingCell() {
UISwitch *_switch;
UILabel *_text;
}
@end

Expand Down Expand Up @@ -42,7 +43,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
- (void)setItem:(ZFSettingItem *)item {
_item = item;
// 设置数据
self.imageView.image = item.icon.length ? [UIImage imageNamed:item.icon] : nil;
self.imageView.image = item.icon.length ? [UIImage imageNamed:item.icon] : nil;
self.textLabel.text = item.title;
if (item.type == ZFSettingItemTypeArrow) {
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
Expand All @@ -53,13 +54,22 @@ - (void)setItem:(ZFSettingItem *)item {
_switch = [[UISwitch alloc] init];
_switch.on = item.switchOn;
[_switch addTarget:self action:@selector(switchStatusChanged:) forControlEvents:UIControlEventValueChanged];
} else {
[_switch setOn:item.switchOn animated:YES];
}
} else {
[_switch setOn:item.switchOn animated:YES];
}
// 右边显示开关
self.accessoryView = _switch;
// 禁止选中
self.selectionStyle = UITableViewCellSelectionStyleNone;
}else if(item.type == ZFSettingItemTypeText){
UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(0,0,item.text.length*10,self.frame.size.height)];
rightLabel.text=item.text;
//rightLabel.textAlignment = NSTextAlignment;
self.accessoryView= rightLabel;
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
// 用默认的选中样式
self.selectionStyle = UITableViewCellSelectionStyleBlue;
//self.accessoryView.backgroundColor= [UIColor lightGrayColor];   //加上红色容易看清楚
} else {
// 什么也没有,清空右边显示的view
self.accessoryView = nil;
Expand Down