IOS彩票第三天界面
******ios6 和ios7的适配
ILBaseTableViewController.m
- (void)viewDidLoad {[super viewDidLoad];// 244 243 241// 设置tableView的背景颜色// ios6 backgroundView > backgroundColorself.tableView.backgroundView = nil;self.tableView.backgroundColor = ILColor(244, 243, 241);// 设置组间距self.tableView.sectionHeaderHeight = 20;self.tableView.sectionFooterHeight = 0;#warning 适配ios7的组间距if (ios7) {self.tableView.contentInset = UIEdgeInsetsMake(-15, 0, 0, 0);}}
************ILSettingCell.m
#import "ILSettingCell.h"#import "ILSettingItem.h"#import "ILSettingArrowItem.h" #import "ILSettingSwitchItem.h" #import "ILSettingLabelItem.h"@interface ILSettingCell()@property (nonatomic, strong) UIImageView *imgView; @property (nonatomic, strong) UISwitch *switchView; @property (nonatomic, strong) UILabel *labelView;@property (nonatomic, weak) UIView *divider;@end@implementation ILSettingCell- (UIView *)divider {if (_divider == nil) {if (!ios7) { // 不是ios7才需要创建分割线UIView *divider = [[UIView alloc] init];divider.backgroundColor = [UIColor blackColor];divider.alpha = 0.2;[self.contentView addSubview:divider];_divider = divider;}}return _divider; }- (UILabel *)labelView {if (_labelView == nil) {_labelView = [[UILabel alloc] init];_labelView.bounds = CGRectMake(0, 0, 100, 44);_labelView.textColor = [UIColor redColor];_labelView.textAlignment = NSTextAlignmentRight;}return _labelView; }- (UIImageView *)imgView {if (_imgView == nil) {_imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"CellArrow"]];}return _imgView; }- (UISwitch *)switchView {if (_switchView == nil) {_switchView = [[UISwitch alloc] init];}return _switchView; }- (void)setItem:(ILSettingItem *)item {_item = item;// 1.设置cell的子控件的数据 [self setUpData];// 2.设置右边视图 [self setUpAccessoryView];}// 设置cell的子控件的数据 - (void)setUpData {if (_item.icon.length) {self.imageView.image = [UIImage imageNamed:_item.icon];}self.textLabel.text = _item.title;self.detailTextLabel.text = _item.subTitle; }// 设置右边视图 - (void)setUpAccessoryView {if ([_item isKindOfClass:[ILSettingArrowItem class]]) { // 箭头self.accessoryView = self.imgView;self.selectionStyle = UITableViewCellSelectionStyleDefault;}else if ([_item isKindOfClass:[ILSettingSwitchItem class]]){ // Switchself.accessoryView = self.switchView;self.selectionStyle = UITableViewCellSelectionStyleNone;}else if ([_item isKindOfClass:[ILSettingLabelItem class]]){self.accessoryView = self.labelView;ILSettingLabelItem *labelItem = (ILSettingLabelItem *)_item;self.labelView.text = labelItem.text;self.selectionStyle = UITableViewCellSelectionStyleDefault;}else{self.accessoryView = nil;self.selectionStyle = UITableViewCellSelectionStyleDefault;} }#warning 快速创建cell + (instancetype)cellWithTableView:(UITableView *)tableView {static NSString *ID = @"cell";ILSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:ID ];if (cell == nil) {cell = [[ILSettingCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:ID];}return cell; }#warning 判断分割线是否需要显示 - (void)setIndexPath:(NSIndexPath *)indexPath {_indexPath = indexPath;self.divider.hidden = indexPath.row == 0;}- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {// 237 233 218// 设置背景 [self setUpBg];// 清空子视图的背景 [self setSubViews];}return self; } #warning 设置背景 - (void)setUpBg {// 设置背景图片UIView *bg = [[UIView alloc] init];bg.backgroundColor = [UIColor whiteColor];self.backgroundView = bg;// 设置选中的背景图片UIView *selectedBg = [[UIView alloc] init];selectedBg.backgroundColor = ILColor(237, 233, 218);self.selectedBackgroundView = selectedBg; }#warning 清空子控件的背景颜色 - (void)setSubViews {self.textLabel.backgroundColor = [UIColor clearColor];self.detailTextLabel.backgroundColor = [UIColor clearColor]; }#warning 适配ios6的cell - (void)setFrame:(CGRect)frame {if (!ios7) {frame.size.width += 20;frame.origin.x -= 10;}[super setFrame:frame]; }#warning 设置分割线的frame - (void)layoutSubviews {[super layoutSubviews];CGFloat dividerX = self.textLabel.frame.origin.x;CGFloat dividerY = 0;CGFloat dividerH = 1;CGFloat dividerW = 320;self.divider.frame = CGRectMake(dividerX, dividerY, dividerW, dividerH); }@end
***********短信 分享,邮件分享ILShareViewController.h
#import "ILShareViewController.h"#import "ILSettingItem.h"#import "ILSettingArrowItem.h" #import "ILSettingGroup.h"#import "UMSocial.h"#import <MessageUI/MessageUI.h>@interface ILShareViewController ()<MFMessageComposeViewControllerDelegate,MFMailComposeViewControllerDelegate>@property (nonatomic, assign) int age;@end@implementation ILShareViewController- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.// 0组 [self addGroup0];}- (void)addGroup0 {// 0组ILSettingArrowItem *sina = [ILSettingArrowItem itemWithIcon:@"WeiboSina" title:@"新浪分享" ];sina.option = ^{[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToSina] content:@"分享内嵌文字" image:nil location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *response){if (response.responseCode == UMSResponseCodeSuccess) {NSLog(@"分享成功!");}}];};ILSettingItem *sms = [ILSettingArrowItem itemWithIcon:@"SmsShare" title:@"短信分享"];__weak ILShareViewController *share = self;sms.option = ^{MFMessageComposeViewController *vc = [[MFMessageComposeViewController alloc] init];// 设置短信内容vc.body = @"吃饭了没?";// 设置收件人列表vc.recipients = @[@"10010", @"02010010"];// 设置代理vc.messageComposeDelegate = share;share.age;// 显示控制器 [share presentViewController:vc animated:YES completion:nil];};ILSettingItem *mail = [ILSettingArrowItem itemWithIcon:@"MailShare" title:@"邮件分享"];mail.option = ^{// 不能发邮件if (![MFMailComposeViewController canSendMail]) return;MFMailComposeViewController *vc = [[MFMailComposeViewController alloc] init];// 设置邮件主题[vc setSubject:@"会议"];// 设置邮件内容[vc setMessageBody:@"今天下午开会吧" isHTML:NO];// 设置收件人列表[vc setToRecipients:@[@"643055866@qq.com"]];// 设置抄送人列表[vc setCcRecipients:@[@"1234@qq.com"]];// 设置密送人列表[vc setBccRecipients:@[@"56789@qq.com"]];// 添加附件(一张图片)UIImage *image = [UIImage imageNamed:@"阿狸头像"];NSData *data = UIImagePNGRepresentation(image);[vc addAttachmentData:data mimeType:@"image/png" fileName:@"阿狸头像.png"];// 设置代理 // vc.mailComposeDelegate = self; // // 显示控制器 // [self presentViewController:vc animated:YES completion:nil]; };ILSettingGroup *group0 = [[ILSettingGroup alloc] init];group0.items = @[sina,sms,mail];[self.dataList addObject:group0]; }- (void)dealloc {NSLog(@"dealloc"); }// 当你取消发送短信的时候就会调用 - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {[self dismissViewControllerAnimated:YES completion:nil]; }- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {[self dismissViewControllerAnimated:YES completion:nil]; } @end
ILShareViewController .h
#import "ILBaseTableViewController.h"@interface ILShareViewController : ILBaseTableViewController@end
*****拨打电话ILAboutViewController.m
#import "ILAboutViewController.h"#import "ILSettingItem.h"#import "ILSettingArrowItem.h" #import "ILSettingGroup.h"#import "ILAboutHeaderView.h"@interface ILAboutViewController () @property (nonatomic, strong) UIWebView *webView; @end@implementation ILAboutViewController- (UIWebView *)webView {if (_webView == nil) {_webView = [[UIWebView alloc] init];}return _webView; }- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.// 0组 [self addGroup0];self.tableView.tableHeaderView = [ILAboutHeaderView headerView];}- (void)addGroup0 {// 0组ILSettingArrowItem *score = [ILSettingArrowItem itemWithIcon:nil title:@"评分支持" destVcClass:nil];score.option = ^{// 评分NSString *appid = @"635768442";NSString *str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/cn/app/id%@?mt=8", appid];[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];};ILSettingItem *tel = [ILSettingArrowItem itemWithIcon:nil title:@"客服电话"];tel.subTitle = @"020-83568090";tel.option = ^{[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"tel://10010"]]];};ILSettingGroup *group0 = [[ILSettingGroup alloc] init];group0.items = @[score,tel];[self.dataList addObject:group0];}@end
******帮助界面
#import "ILHelpViewController.h"#import "ILSettingCell.h"#import "ILSettingItem.h"#import "ILSettingArrowItem.h" #import "ILSettingSwitchItem.h"#import "ILSettingGroup.h"#import "ILHtml.h"#import "ILHtmlViewController.h"#import "ILNavigationController.h"@interface ILHelpViewController () @property (nonatomic, strong) NSMutableArray *htmls; @end@implementation ILHelpViewController- (NSMutableArray *)htmls {if (_htmls == nil) {_htmls = [NSMutableArray array];NSString *fileName = [[NSBundle mainBundle] pathForResource:@"help.json" ofType:nil];NSData *data = [NSData dataWithContentsOfFile:fileName];NSArray *jsonArr = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];for (NSDictionary *dict in jsonArr) {ILHtml *html = [ILHtml htmlWithDict:dict];[_htmls addObject:html];}}return _htmls; }- (void)viewDidLoad {[super viewDidLoad];// 0组 [self addGroup0];}- (void)addGroup0 {// 0组NSMutableArray *items = [NSMutableArray array];for (ILHtml *html in self.htmls) {ILSettingArrowItem *item = [ILSettingArrowItem itemWithIcon:nil title:html.title destVcClass:nil];[items addObject:item];}ILSettingGroup *group0 = [[ILSettingGroup alloc] init];group0.items = items;[self.dataList addObject:group0];}// 重写tableView的点击 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {// 取出每一行对应的Html模型ILHtml *html = self.htmls[indexPath.row];ILHtmlViewController *htmlVc = [[ILHtmlViewController alloc] init];htmlVc.title = html.title;htmlVc.html = html;ILNavigationController *nav = [[ILNavigationController alloc] initWithRootViewController:htmlVc];[self presentViewController:nav animated:YES completion:nil]; }@end
********webview 的页面
#import "ILHtmlViewController.h"#import "ILHtml.h"@interface ILHtmlViewController ()<UIWebViewDelegate>@end@implementation ILHtmlViewController- (void)loadView {self.view = [[UIWebView alloc] init]; }- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view. self.view.backgroundColor = [UIColor whiteColor];UIBarButtonItem *cancle = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStyleBordered target:self action:@selector(cancle)];self.navigationItem.leftBarButtonItem = cancle;UIWebView *webView = (UIWebView *)self.view;// 加载资源包里面的HtmlNSURL *url = [[NSBundle mainBundle] URLForResource:_html.html withExtension:nil];NSURLRequest *request = [NSURLRequest requestWithURL:url];webView.delegate = self;[webView loadRequest:request];}// 加载完网页调用 - (void)webViewDidFinishLoad:(UIWebView *)webView {NSString *js = [NSString stringWithFormat:@"window.location.href = '#%@';",_html.ID];[webView stringByEvaluatingJavaScriptFromString:js]; }- (void)cancle {// 回到上一个控制器 [self dismissViewControllerAnimated:YES completion:nil];} @end
.h
#import <UIKit/UIKit.h>@class ILHtml; @interface ILHtmlViewController : UIViewController@property (nonatomic, strong) ILHtml *html;@end
转载于:https://www.cnblogs.com/ios-g/p/4791187.html
IOS彩票第三天界面相关推荐
- IOS炫酷的引导界面
代码地址如下: http://www.demodashi.com/demo/11246.html 一.准备工作 1.先用时ps工具制作好图片 2.然后计算好每张图片通过滑动视图的偏移量来改变图片的位置 ...
- 杯具,知名游戏的源码丢了;iOS 11 第三个开发者测试版发布
(点击上方公众号,可快速关注) 参考:开源中国.腾讯.solidot.cnBeta.IT之家等 0.杯具!<冰风谷 II>的源代码丢了! 开发了加强版 <博德之门>和<异 ...
- 分享一套超棒的iOS “空状态” (empty state) 界面UI设计
日期:2013-2-1 来源:GBin1.com 大家在程序开发或者界面设计中常常会遇到这样一些情况: 404 error 内容未找到 账户余额不够 文件没有找到 等等 这 些典型的属于empty ...
- Android 仿PhotoShop调色板应用(三) 主体界面绘制
版权声明:本文为博主原创文章,未经博主允许不得转载. Android 仿PhotoShop调色板应用(三) 主体界面绘制 关于PhotoShop调色板应用的实现我总结了两个最核心的部分: 1 ...
- iOS编写最简单的界面切换应用
以下是在iOS中最简单的界面切换示例.使用了多个Controller,并演示Controller之间在切换界面时的代码处理. 实现的应用界面: 首先,创建一个window-based applicat ...
- MFC 视图-OpenGL场景-CDialogBar三个界面保存为图片
问题:如图所示的OpenGL场景.View.CDialogBar三个界面的内容保存成图片然后拼合成一张图 思路: 分四步 一.View视图界面保存 利用BitBlt函数将界面拷贝到内存DC中 // 将 ...
- Android4.2.2 Gallery2源码分析(9)——三个界面的跳转
Gallery浏览图片除开编辑界面,主要有三个界面:即起始页,相册簿集合页面(AlbumSetPage):点击某个相册进入该相册的所有图片页面(AlbumPage)和再点击某张具体图片之后的图片浏览页 ...
- Android布局之线性布局LinearLayout(二) ----简单模仿ios端小米计算器主界面UI
Android布局之线性布局LinearLayout(二) ----简单模仿ios端小米计算器主界面UI 今天老师的要求是让用LinearLayout布局做自己手机自带的计算器的UI设计,因为io ...
- iOS内购三:Receipt
iOS内购三:Receipt 可参考: Validating Receipts Locally 需验证receipt,可以在本地验证,也可以在服务端验证 本地验证,涉及到security和加密,比较复 ...
最新文章
- Resnet对应于ImageNet的结构框架
- STM32开发 -- 打开网址测试脚本编写
- java收获_java学习收获
- PAT_B_1025_Java(22分)
- IDEA 快捷键终极大全
- Android 防火墙 知乎,知乎回应:防火墙太“坑爹” 正检查用户隐私是否有泄露...
- Java笔记-spring boot支持jsp文件做前端页面
- matlab bs2rv.m,matlab遗传算法工具箱中的例子不能用?
- 红橙Darren视频笔记 旋转加载界面
- CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.ts
- Python 3.7 即将发布,引入多项新功能!
- Vue 当中的计算属性computed
- Xcode连接git@osc
- docker运行redis命令
- java修改yml文件
- android 画爱心进度条_android自定义圆形进度条,实现动态画圆效果
- 总价+激励合同(FPIF)的计算,与CPIF的区别
- 市场调研报告-全球与中国数字钥匙模块市场现状及未来发展趋势
- HarmonyOS之深入解析相机的功能和使用
- 全选反选的逻辑和代码