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 ...
随机推荐
- React Redux Sever Rendering实战
# React Redux Sever Rendering(Isomorphic JavaScript) - 数组
数组定义 数组就是一个键值对组成的语言结构,键类似于酒店的房间号,值类似于酒店房间里存储的东西.PHP 中的数组实际上是一个有序映射.映射是一种把 values 关联到 keys 的类型. 定义数组 ...
- xmpp搭建服务器
二.环境配置1.安装mysql2.修改mysql的帐户的密码>sqlite(移动平台) ,是没有密码直接连接数据库>mysql sqlServer (服务端的数据库) 是有帐户和密码 默 ...
- South——谁说Django不能migrate!
零.前言 最近改一个项目,需要对已有的model进行更改.大家都知道Django自带的syncdb只能创建数据库,但是无法将已经改变的model应用的数据库中. 大概两年前遇到这个问题的时候,网上的答 ...
- gulp构建工具的安装
第一步:node.js安装 在gulp安装之前,本机需要node环境.访问http://nodejs.org,然后点击大大的绿色的install按钮,下载完成后直接运行程序.npm会随着安装包一起安装 ...
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in
php 5个版本,5.2.5.3.5.4.5.5,怕跟不上时代,新的服务器直接上5.5,但是程序出现如下错误:Deprecated: mysql_connect(): The mysql extens ...
- [改善Java代码]性能考虑,数组是首选
建议60:性能考虑,数组是首选 一.分析 数组在实际的系统开发中使用的越来越少,我们通常只有在阅读一些开源项目时才会看到它们的身影,在Java中它确实没有List.Set.Map这些集合使用起来方便 ...
- poj 3565 二分图最优匹配
思路: 将ant与tree之间用距离来做权值,求最小权匹配就可以了.可以想到,如果有两条线段相交,那么将这两个线段交换一个顶点,使其不相交,其权值和一定会更小. 就像斜边永远比直角边长一样的道理. # ...
- 转:艾瑞咨询2016 IM云的发展趋势
转自: http://www.cnblogs.com/lingyunhu/p/rtc63.html
- Redis 命令 - Server
BGREWRITEAOF Asynchronously rewrite the append-only file BGSAVE Asynchronously save the dataset to d ...