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 ...
随机推荐
- cocos2d-x lua 使用自定义消息EventCustom
cocos2d-x lua 使用自定义消息EventCustom version: cocos2d-x 3.6 1.发送消息 -- post message -- event将会被传递给消息接收函数, ...
- 两个UIView添加同一个手势只有最后一个有用
首先这个思路是不对的,因为每一个Gesture Recognizer关联一个View,但是一个View可以关联多个Gesture Recognizer,因为一个View可能还能响应多种触控操作方式.当 ...
- AngularJs学习经验汇集
>>关于ng-include 有时候你会发现你用这个指令想要加载某个模板总是加载不出来,url明明是对的,页面还是一片空白,这里有一个细节要注意以下: <div ng-include ...
- Adobe Edge Animate –获取鼠标位置及跟随鼠标功能实现
Adobe Edge Animate –获取鼠标位置及跟随鼠标功能实现 版权声明: 本文版权属于 北京联友天下科技发展有限公司. 转载的时候请注明版权和原文地址. 在网络上浏览有关Edge相关问题的时 ...
- [转]每次打开IE9就会跳出管理加载项的窗口
当您打开IE9就跳出管理加载项的窗口,这一般是由于使用优化软件对系统进行优化清理后导致了注册表的错误.上次我们就为大家介绍了关于IE9启动后自动弹出管理加载项窗口的问题,这两个问题非常类似,引发问题的 ...
- 【Irrlicht鬼火引擎】掌握引擎使用流程,入门程序HelloWorld
分析 一.简述使用步骤 一般而言,对于一个简单的程序,Irrlicht引擎的一般使用步骤如下: 预处理:(1)包含 <irrlicht.h> 头文件#include <irrlich ...
- 24小时学通Linux内核之进程
都说这个主题不错,连我自己都觉得有点过大了,不过我想我还是得坚持下去,努力在有限的时间里学习到Linux内核的奥秘,也希望大家多指点,让我更有进步.今天讲的全是进程,这点在大二的时候就困惑了我,结果那 ...
- 随机生成MyEclipse注册码
package com.registercode; import java.io.BufferedReader;import java.io.IOException;import java.io.In ...
- InternetOpen怎么使用代理
如果你用IE的默认代理设置:hinternet=InternetOpen(AfxGetAppName(),INTERNET_OPEN_TYPE_PROXY,NULL,NULL,0); 把INTERNE ...
- Editplus中使用正则表达式压缩代码
快捷键ctrl+H打开查找与替换窗口,勾上使用正则表达式选项,查找项输入\t|^( )+,替换范围选当前文档,选择全部替换按钮,然后查找项在输入\n,再选择全部替换按钮. 大功告成!