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 ...
随机推荐
- XGPush集成(信鸽集成)
#import "AppDelegate.h" #import "XGPush.h" #import "XGSetting.h" #defi ...
- 查看Oracle执行计划的几种方法
查看Oracle执行计划的几种方法 一.通过PL/SQL Dev工具 1.直接File->New->Explain Plan Window,在窗口中执行sql可以查看计划结果.其中,Cos ...
- CF Tavas and Karafs (二分)
Tavas and Karafs time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- [改善Java代码]减少HashMap中元素的数量
在系统开发中我们经常会使用HashMap作为数据集容器,或者是用缓冲池来处理,一般很稳定,但偶尔也会出现内存溢出的问题(OutOfMemory错误),而且这经常是与HashMap有关的.而且这经常是与 ...
- Hive的JDBC使用&并把JDBC放置后台运行
使用JDBC访问HIVE: 首先启动hive的JDBC服务. 进入hive的bin目录: 这样启动是启动到前台.如果 要想启动到后台需要用到Linux的相关命令. 我们先把其放到前台看下效果,之后再把 ...
- 【模拟ACM排名】ZOJ-2593 Ranking (Andrew Stankevich’s Contest #5)
真心是道水题,但找bug找的我想剁手了/(ㄒoㄒ)/~~ 注意几个坑点, 1.输入,getline(cin); / gets(); 一行输入,注意前面要加getchar(); 输入运行记录的时候可 ...
- 【策略】UVa 278 - Chess
Chess Almost everyone knows the problem of putting eight queens on an chessboard such that no Quee ...
- 转:XMPP协议、MQTT协议、HTTP协议、CoAP协议的基本比较
一.先看下相关国外的专业数据对四大协议的比较: Protocol CoAP XMP ...
- Linux 根文件系统的制作
一.建立根文件系统目录与文件 1. 创建目录 #mkdir rootfs #cd rootfs #mkdir bin dev etc lib proc sbin sys usr mnt tmp var ...
- MySQL同主机不同数据库的复制命令
MySQL同主机不同数据库的复制命令:注意运行在Terminal中,不运行在MySQL命令行中. 1 mysqldump Portal_DEV -u root -ppassword1$ --add-d ...