- 浏览: 155321 次
- 性别:
- 来自: 海口
文章分类
最新评论
-
alienxy:
望楼主能提供源码参考,感激不尽。1291365391@qq.c ...
对myflow WEB版工作流设计器进行改进-增加删除功能 -
oushaomeng2011:
楼主能否发一份源码呢,现在项目需要参考类似流程图设计,希望能提 ...
对myflow WEB版工作流设计器进行改进-增加删除功能 -
tuohuang0303:
楼主能否发一份源码呢,现在项目需要参考类似流程图设计,希望能提 ...
对myflow WEB版工作流设计器进行改进-增加删除功能 -
欧阳陈曦:
楼主能不能提供下代码万分感谢。753095374@qq.com ...
对myflow WEB版工作流设计器进行改进-增加删除功能 -
huan890308:
亲 能不能把源码发一份啊 拜谢拜谢!402197729@qq ...
对myflow WEB版工作流设计器进行改进-增加删除功能
自由布局,UIButton样式,下阴影,按钮事件。
导航栏rightBarButtonItem增加UISegmentedControl控件。
#import <QuartzCore/QuartzCore.h> #import "LeagueController.h" #import "WaitDialog.h" #import "JSONParser.h" #import "FunUtil.h" @implementation LeagueController @synthesize selectDate; @synthesize flag; @synthesize topToolBar; @synthesize mainView; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { } return self; } -(id)initWithDate:(CFGregorianDate) date{ self = [super initWithNibName:nil bundle:nil]; if(self){ self.selectDate = date; self.title = @"联赛选择"; NSArray *buttonNames = [NSArray arrayWithObjects:@"所有", @"一级", @"二级", nil]; topToolBar = [[UISegmentedControl alloc] initWithItems:buttonNames]; [topToolBar setFrame:CGRectMake(1, 1, 120, 30)]; topToolBar.selectedSegmentIndex = 0; topToolBar.segmentedControlStyle = UISegmentedControlStyleBar; [topToolBar addTarget:self action:@selector(selectFlag:) forControlEvents:UIControlEventValueChanged]; UIBarButtonItem *segButton = [[UIBarButtonItem alloc] initWithCustomView:topToolBar]; self.navigationItem.rightBarButtonItem = segButton; self.mainView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; [self.view addSubview:mainView]; [segButton release]; self.flag = 0; } return self; } -(void)removeAllView{ for(UIView *subView in [self.mainView subviews]){ [subView removeFromSuperview]; } } - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; self.mainView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); [[WaitDialog sharedWaitDialog] setLoadingLabel:@"加截数据..."]; [NSThread detachNewThreadSelector:@selector(fetchData) toTarget:self withObject:nil]; } -(void)selectFlag:(UISegmentedControl *)Seg{ int index = Seg.selectedSegmentIndex; self.flag = index; [NSThread detachNewThreadSelector:@selector(fetchData) toTarget:self withObject:nil]; } -(void) fetchData{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; NSString *date = [NSString stringWithFormat:@"%d-%d-%d",selectDate.year,selectDate.month,selectDate.day]; NSString *dataURL =@""; NSArray *data = [JSONParser loadData:dataURL isAllValues:NO valueForKey:@"list"]; [self performSelectorOnMainThread:@selector(makeView:) withObject:data waitUntilDone:NO]; [pool release]; } -(void)makeView:(NSArray*)data{ [self removeAllView]; [[WaitDialog sharedWaitDialog]endShowLoading]; if(data == nil || [data count]==0){ UILabel *nullData = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, self.view.frame.size.width-20, 40)]; nullData.text = @"暂时没有数据"; nullData.backgroundColor = [UIColor clearColor]; nullData.font = [UIFont boldSystemFontOfSize:20]; [self.mainView addSubview:nullData]; }else{ int count = [data count]; int i = 0; int x = 10; int y = 10; int cols = 3; int width = self.view.frame.size.width/cols -20; int height = 30; int contentHeight = (height+y*2)*(count/cols); int c = count/cols+1; for(i = 0;i<c;i++){ NSArray *league = [data objectAtIndex:i]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.layer.cornerRadius = 5; btn.layer.shadowOffset = CGSizeMake(3, 5); btn.layer.shadowOpacity = 0.8; btn.layer.shadowColor = [UIColor blackColor].CGColor; btn.frame = CGRectMake(x, y, width, height); btn.backgroundColor = [FunUtil colorWithHexString:[league valueForKey:@"color"]]; [btn setTitleColor:[UIColor whiteColor ]forState:UIControlStateNormal]; [btn setTitle:[league valueForKey:@"cnName"] forState:UIControlStateNormal]; [btn setTag:[[league valueForKey:@"lid"] intValue]]; [btn addTarget:self action:@selector(selectLeague:) forControlEvents:UIControlEventTouchUpInside]; [btn addTarget:self action:@selector(buttonDown:) forControlEvents:UIControlEventTouchDown]; [self.mainView addSubview:btn]; y+=height+10; } contentHeight = (height+10)*c+10; CGSize newSize = CGSizeMake(self.view.frame.size.width, contentHeight); [self.mainView setContentSize:newSize]; } } -(void)selectLeague:(UIButton*)sender{ [sender setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; sender.layer.shadowOffset = CGSizeMake(3, 5); sender.layer.shadowOpacity = 0.8; sender.layer.shadowColor = [UIColor blackColor].CGColor; } -(void)buttonDown:(UIButton*)sender{ [sender setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; sender.layer.shadowOffset = CGSizeMake(0,0); sender.layer.shadowOpacity = 1; sender.layer.shadowColor = [UIColor blackColor].CGColor; } #pragma mark TableViewDataSource Methods - (void)dealloc { [topToolBar release]; [mainView release]; [super dealloc]; } @end
发表评论
-
关注比分在线订阅号
2014-11-11 09:05 196订阅号:wapzq101 二维码 -
完成足球赛事资料库iOS版
2011-10-31 09:22 1953最近无聊,花了些时间整理了下足球赛事资料库数据,准备着手写一个 ... -
最近完成的项目开发,准备下一个编码。
2011-10-25 11:55 1233最近开发完手机办公 for iPhone版,已上传到 App ... -
好的想法来源于一瞬间
2011-08-25 21:13 1241接触iOS开发没多久,最近公司要给用户开发一套基于iPhone ... -
终于完成"进球啦!"
2011-08-10 22:32 1548经过几个星期的学习攻 ... -
进球弹出提醒效果
2011-08-02 22:44 2504最近研究UIView动画,对比分在线客户端使用了很多UIVie ... -
可喜,没有发现内存泄漏出现
2011-07-30 10:04 1069在实现即时比分客户端时,生怕这个模块会出现内存泄漏,所以一写完 ... -
异步加载网络数据,自定义进度条显示
2011-07-29 12:15 4930//调用方式 Ajax *ajax = ... -
iphone窗口传值
2011-07-26 22:24 1875比如有view1和view2view1的init内[[NSNo ... -
iPhone版比分在线客户端成型
2011-07-25 23:19 1126今天有意无意间,闲着也是闲着,玩玩iPhone开发 比 ... -
大屏日历异步加载每天比赛数目并显示在日历里
2011-07-23 22:30 2128#import <QuartzCore/Quart ... -
TTView的简单使用
2011-06-19 19:17 1427转自:http://c.gzl.name/archives ... -
又有新的进步,继续努力
2011-06-16 17:02 880UIView自由布局 UIScrollerView 下拉到最 ... -
刚刚开始学习iPhone开发,记录一下
2011-06-15 23:01 880即时比分播报 -
UIView背景图固定不滚动实现
2011-06-15 20:01 1700- (id)initWithNibName:(NSStr ... -
16进制颜色(html颜色值)字符串转为UIColor
2011-06-15 12:04 2385互联应用经常会用到html颜色值转换UIColor,比如:#F ... -
获取字符串所占像素长度
2011-06-14 19:57 1805在图生上处理字符的时候,需要得到字符串所占位置长度。这长度与字 ... -
为UIView及其子类添加圆角边框
2011-06-14 19:35 24651.添加QuartzCore.framework 2.实现代 ... -
iPhone设置视图背景图片的方法
2011-06-14 17:34 1811方法一,使用一个UIImageView实例做子视图 ... -
解决一个问题,郁闷好久的问题
2011-06-14 15:34 1144在创建UIButton时,点击动作里老是读取不到成员变量。调试 ...
相关推荐
iPhone开发实战 iPhone开发 iPhone iPhone4 iPhone开发实战 iPhone开发 iPhone iPhone4
Iphone开发系列源码——Iphone主题源码Iphone开发系列源码——Iphone主题源码Iphone开发系列源码——Iphone主题源码Iphone开发系列源码——Iphone主题源码Iphone开发系列源码——Iphone主题源码Iphone开发系列源码...
这里推荐两本书《objective-c基础教程》和《iphone开发基础教程》,这两本都是圣经级的巨作,我相信每一个iphone开发人员应该都不会错过这两本书的。 等你xcode和objective-c摸熟之后,或者说,上面提到的那两...
Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码...
iPhone开发,iPhone开发教程,iPhone开发基础教程PDF版
Iphone开发系列源码——Image图片缩放随着手指Iphone开发系列源码——Image图片缩放随着手指Iphone开发系列源码——Image图片缩放随着手指Iphone开发系列源码——Image图片缩放随着手指Iphone开发系列源码——Image...
《iPhone开发基础教程》内容完整丰富,具有较强的通用性,编程领域中各层次读者都能通过《iPhone开发基础教程》快速学习iPhone开发,提高相关技能。iPhone 是一种全新的移动平台,苹果公司为它推出了强大的软件开发...
资源名称:iPhone开发入门到精通视频教程资源目录:【】iOS开发源码系列---工具【】iOS开发源码系列---应用【】iOS开发源码系列---游戏【】iOS开发源码系列---类库与框架【】iOS开发真机测试与发布【】iOS开发视频...
轻松学iPhone共分3篇。第1篇介绍iPhone的发展、iPhone开发环境以及开发工具的安装过程、iPhone Simulator模拟器
本书全面探讨了iPhone平台的两种编程方式——Web开发和SDK编程。全在Web开发方面,分别介绍了三个iPhone Web库,即WebKit、iUI和Canvas,并讨论了Web开发环境Dashcode,最后阐述Web应用程序的调试。在SDK开发方面,...
iPhone游戏开发iPhone游戏开发iPhone游戏开发iPhone游戏开发iPhone游戏开发iPhone游戏开发iPhone游戏开发iPhone游戏开发iPhone游戏开发iPhone游戏开发
iphone开发秘籍,移动手机开发,参照软件开发应用
iPhone开发实战
这是一本很不错的iphone开发入门级教程
知名的Head First系列丛书之一,风格与其他Head First系列一脉相承,一定能让读者轻松学会iPhone开发,《深入浅出iPhone开发》是针对iPhone开发的初学者设计的,以几个应用实例的开发为例,循序渐进地对iPhone开发的...
《深入浅出iPhone开发》,本书是针对iPhone开发的初学者设计的,以几个应用实例的开发为例,循序渐进地对iPhone开发的各个方面进行了讲解。
Iphone开发系列源码——多功能播放器源码Iphone开发系列源码——多功能播放器源码Iphone开发系列源码——多功能播放器源码Iphone开发系列源码——多功能播放器源码Iphone开发系列源码——多功能播放器源码Iphone开发...
资源名称:iphone开发视频教程资源目录:【】iphone开发视频教程第1集 Mac.OS.X,Cocoa,Touch,Objective-C【】iphone开发视频教程第2集 各种基础的类,功能,对象和实例的介绍【】iphone开发视频教程第3集 如何创建你...
Iphone开发系列源码——星级评价实现代码Iphone开发系列源码——星级评价实现代码Iphone开发系列源码——星级评价实现代码Iphone开发系列源码——星级评价实现代码Iphone开发系列源码——星级评价实现代码Iphone开发...
[iphone.开发书籍 高清PDF]iphone3开发基础教程.part3