iphone开发第二个程序
此程序包括UIProgressView,UIButton, UIDatePicker,UIAlert,UILabel,NSTimer
//
// HViewController.h
// Btn_lbl
//
// Created by public on 13-7-18.
// Copyright (c) 2013年 All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HViewController : UIViewController
@property (retain, nonatomic) IBOutlet UIDatePicker *hdatePicker;
@property (retain, nonatomic) IBOutlet UILabel *lblText;
@property (retain, nonatomic) IBOutlet UIProgressView *progress;
@property (retain, nonatomic) IBOutlet UIProgressView *progressBar;
@property (retain, nonatomic) IBOutlet UIButton *btnStart;
@property (retain, nonatomic) IBOutlet UIButton *btnStop;
@property(retain,nonatomic)IBOutlet NSTimer* timer;
- (IBAction)btnClick:(id)sender;
- (IBAction)dateChange;
- (IBAction)startProgress:(id)sender;
- (IBAction)stopProgress:(id)sender;
- (IBAction)startHeadProgress:(id)sender;
@end
//
// HViewController.m
// Btn_lbl
//
// Created by public on 13-7-18.
// Copyright (c) 2013年 . All rights reserved.
//
#import "HViewController.h"
@interface HViewController ()
@end
@implementation HViewController
#pragma mark 加载数据
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSDate* hdate=[NSDate date];
[_hdatePicker setDate:hdate animated:YES];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)dealloc {
[_lblText release];
[_hdatePicker release];
[_progress release];
[_timer release];
[_btnStart release];
[_progressBar release];
[_btnStop release];
[super dealloc];
}
#pragma mark -按钮的测试点击事件
- (IBAction)btnClick:(id)sender{
UIButton * button=(UIButton *)sender;
_lblText.font=[UIFont fontWithName:@"Bold" size:25];
_lblText.backgroundColor=[UIColor blueColor];
_lblText.textColor=[UIColor whiteColor];
_lblText.text=@"中华";
NSString* tittle=[NSString stringWithFormat:@"UILabel的内容是:%@,UIButton 的 tag 是 %d",_lblText.text,button.tag];
NSString* message=[button currentTitle];
UIAlertView* alert=[[UIAlertView alloc]initWithTitle:tittle message:message delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"cancel", nil];
[alert show];
[alert release];
}
#pragma mark -日历的改变
- (IBAction)dateChange {
NSDate* date=[_hdatePicker date];
NSDateFormatter *format=[[NSDateFormatter alloc]init];
[format setDateStyle:NSDateFormatterShortStyle];
[format setTimeStyle:NSDateFormatterShortStyle];
_lblText.text=[NSString stringWithFormat:@"%@",[format stringFromDate:date]];
[format release];
}
#pragma mark -Progress View进度条
-(void)changetimer
{
_progress.progress+=0.001f;
self.progressBar.progress+=0.001f;
}
- (IBAction)startProgress:(id)sender {
_timer=[NSTimer scheduledTimerWithTimeInterval:0.03f target:self selector:@selector(changetimer) userInfo:nil repeats:YES];
[_timer retain];
[_btnStart setEnabled:NO];
[_btnStop setEnabled:YES];
}
- (IBAction)stopProgress:(id)sender {
[_timer invalidate];
[_timer release];
[_btnStart setTitle:@"继续" forState:UIControlStateNormal];
UIColor *color=[UIColor blueColor];
[_btnStart setTitleColor:color forState:UIControlStateNormal];
[_btnStart setEnabled:YES];
[_btnStop setEnabled:NO];
}
- (IBAction)startHeadProgress:(id)sender {
_progress.progress=0.0f;
_progressBar.progress=0.0f;
[_btnStart setTitle:@"开始" forState:UIControlStateNormal];
UIColor *color=[UIColor blueColor];
[_btnStart setTitleColor:color forState:UIControlStateNormal];
}
@end
iphone开发第二个程序的更多相关文章
- 使用wepy开发微信小程序商城第二篇:路由配置和页面结构
使用wepy开发微信小程序商城 第二篇:路由配置和页面结构 前言: 最近公司在做一个微信小程序的项目,用的是类似于vue的wepy框架.我也借此机会学习和实践一下. 小程序官方文档:https://d ...
- iOS开发教程之:iPhone开发环境搭建
安装条件: 硬件:一台拥有支持虚拟技术的64位双核处理器和2GB以上内存的PC. 注意:运行MAC OS,需要电脑支持虚拟技术(VT),安装时,需要将VT启动,在BIOS中开启. 软件: Window ...
- iphone开发 IOS 组织架构图
转载自 :http://blog.csdn.net/mashi321323/article/details/18267719 登录|注册 mashi321323的专栏 目录视图 ...
- 我常用的iphone开发学习网站[原创]
引用地址:http://www.cnblogs.com/fuleying/archive/2011/08/13/2137032.html Google 翻译 Box2d 托德的Box2D的教程! Bo ...
- iPhone开发与cocos2d 经验谈
转CSDN jilongliang : 首先,对于一个完全没有mac开发经验,甚至从没摸过苹果系统的开发人员来说,首先就是要熟悉apple的那一套开发框架(含开发环境IDE.开发框架uikit,还有开 ...
- iOS开发UI篇—iPad和iPhone开发的比较
一.iPad简介 1.什么是iPad 一款苹果公司于2010年发布的平板电脑 定位介于苹果的智能手机iPhone和笔记本电脑产品之间 跟iPhone一样,搭载的是iOS操作系统 2.iPad的市场情况 ...
- 利用Scala语言开发Spark应用程序
Spark内核是由Scala语言开发的,因此使用Scala语言开发Spark应用程序是自然而然的事情.如果你对Scala语言还不太熟悉,可 以阅读网络教程A Scala Tutorial for Ja ...
- iPad和iPhone开发区别
原文:http://mobile.51cto.com/iphone-273895.htm iPad与iPhone 开发区别详解是本文要介绍的内容,先来看看他们的区别. 1.首先我们先从官方发布的SDK ...
- iPhone开发视频教程 Objective-C部分 (51课时)
第一.二章 OC基础语法 iPhone开发教程 第一章 OC基础语法 iPhone开发概述-必看(1.1)http://www.apkbus.com/android-102215-1-1.html ...
随机推荐
- 小白日记42:kali渗透测试之Web渗透-SQL盲注
SQL盲注 [SQL注入介绍] SQL盲注:不显示数据库内建的报错信息[内建的报错信息帮助开发人员发现和修复问题],但由于报错信息中提供了关于系统的大量有用信息.当程序员隐藏了数据库内建报错信息,替换 ...
- Calendar Game
http://poj.org/problem?id=1082 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4820 A ...
- cocos2d-x触摸分发器原理
屏幕捕捉到触摸消息的派发流程: 如果有一个组件如果想要接收触摸事件,会通过继承一个CCTouchDelegate接口注册给CCTouchDispatcher,CCTouchDispatcher 中维护 ...
- cocos2d-x之MoonWarriors用c++实现
玩了sample里面的cocos2d-html5的MoonWarriros,感觉效果做得挺不错的,但是源代码是javascript,鄙人又不会这门语言. github上也有别人贡献的c++代码,不过还 ...
- css笔记02:选择器(标签式和类)
body { margin:; padding:; background:#000 url('images/backgrounds/star.png') no-repeat fixed; font: ...
- 转载:Restore SQL Server database and overwrite existing database
转载自:https://www.mssqltips.com/sqlservertutorial/121/restore-sql-server-database-and-overwrite-existi ...
- Telnet客户端连接服务器,看不见字符,只显示横线
Telnet 窗口看不见字符,只显示小横线 在用telnet连接tomcat服务器的 时候,窗口中不显示字符,显示成一个一个的横线 解决办法: 按住“Ctrl+]” 回车解决问题
- 伸展树 Splay Tree
Splay Tree 是二叉查找树的一种,它与平衡二叉树.红黑树不同的是,Splay Tree从不强制地保持自身的平衡,每当查找到某个节点n的时候,在返回节点n的同时,Splay Tree会将节点n旋 ...
- 用java调用oracle存储过程总结(转)
//1.call+包名+存储过程名(传入.传出值用?) String str="{call SMSBUSINESS.deleteZhZMember(?,?,?)}"; //2.建立 ...
- sendkeys用法详解
将一个或多个按键消息发送到活动窗口,就如同在键盘上进行输入一样. 语法 SendKeys string[, wait] SendKeys 语句的语法具有以下几个命名参数: 部分 描述 string ...