Gavin.han

致力于移动开发 技术改变生活
随笔 - 133, 文章 - 0, 评论 - 46, 阅读 - 42万

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

10 2012 档案

摘要:简单的显示Google地图添加MapKit.Framework框架HomeViewController.h code:#import <UIKit/UIKit.h>#import <MapKit/MapKit.h>@interface HomeViewController : UIViewController{ MKMapView *map;}@endHomeViewController.m code:#import "HomeViewController.h"@interface HomeViewController ()@end@implemen 阅读全文

posted @ 2012-10-31 13:35 gavin.han 阅读(588) 评论(0) 推荐(0) 编辑

摘要:新建Empty Application,添加HomeViewControllerHomeViewController.h代码#import <UIKit/UIKit.h>#import <MediaPlayer/MediaPlayer.h>@interface HomeViewController : UIViewController{ MPMoviePlayerViewController *playerViewController;}- (IBAction)buttonClicked:(id)sender;@endHomeViewController.m代码#imp 阅读全文

posted @ 2012-10-31 13:20 gavin.han 阅读(447) 评论(0) 推荐(0) 编辑

摘要:新建Empty Applicaton,添加HomeViewController文件。还是看代码吧,将理论太枯燥,理论在代码中会提到。HomeViewController.h代码:#import <UIKit/UIKit.h>#import <AVFoundation/AVFoundation.h>@interface HomeViewController : UIViewController<AVAudioRecorderDelegate, AVAudioPlayerDelegate>{}@property (nonatomic, retain) AVAud 阅读全文

posted @ 2012-10-30 22:28 gavin.han 阅读(9306) 评论(0) 推荐(1) 编辑

摘要:ios 音频的播放使用到AVFoundation框架。其包含三个主要的类:AVAudioPlayer、AVAudioRecorder和AVAudioSession。它们负责音频的播放、录制和配置,而且都有相对应的delegate协议。支持的格式有:caf/m4a/mp3/aif/wav/au/snd/aac.能够提供基本的播放操作:创建、准备、播放、暂停、跳过和停止,并且支持多个AVAudioPlayer对象的使用。支持音量调节控制、循环播放和左右声道设置等。 AVAudioPlayerDelegate协议有以下重要方法: audioPlayerBeginInterruptio... 阅读全文

posted @ 2012-10-30 20:55 gavin.han 阅读(5258) 评论(1) 推荐(0) 编辑

摘要:一、使用NSTimer实现动画1.新建empty AppLication,添加HomeViewController页面, iphone.png图片2.在HomeViewController.xib中添加Image View,并调整其大小;再添加一个Slider控件3.HomeViewController.h代码:#import <UIKit/UIKit.h>@interface HomeViewController : UIViewController{ CGPoint delta;//坐标变化量 NSTimer *timer; CGSize picSize;//图片大小 }@pr 阅读全文

posted @ 2012-10-29 21:55 gavin.han 阅读(5015) 评论(0) 推荐(1) 编辑

摘要:一、在Firefox中打开sqlite3(如果没有,选择工具->附加组件,添加即可)新建sqlite3数据库,Contacts,建立一个members表,字段 id,integer,主键,自增;name,varchar;email,varchar,null;birthday,datetime,null。向表中添加一些数据:二、新建Empty Appliation,添加一个HomeViewController,和一个组件libsqlite3.dylib,来支持对sqlite3的连接,关闭,增删改查等操作。1.HomeViewController.h代码:#import <UIKit/ 阅读全文

posted @ 2012-10-29 13:12 gavin.han 阅读(21269) 评论(2) 推荐(0) 编辑

摘要:通过plist文件存取文件在ios文件处理(一)的项目中,修改HomeViewController.m的viewDidLoad方法- (void)viewDidLoad{/* NSString *fileName = [[self documentsPath] stringByAppendingPathComponent:@"content.txt"]; //NSString *fileName = [[self tempPath] stringByAppendingPathComponent:@"content.txt"]; [self writeTo 阅读全文

posted @ 2012-10-28 17:10 gavin.han 阅读(492) 评论(0) 推荐(0) 编辑

摘要:一.在Documents、tmp和Library中存储文件Documents:用于存储应用程序中经常需要读取或写入的常规文件。tmp:用于存储应用程序运行时生成的文件。(随着应用程序的关闭失去了利用价值)Library:一般存放应用程序的配置文件,比如说plist类型的文件。二.读取和写入文件 1.新建Empty Application应用程序,添加HomeViewController文件HomeViewController.h代码:#import <UIKit/UIKit.h>@interface HomeViewController : UIViewController{ }- 阅读全文

posted @ 2012-10-28 16:19 gavin.han 阅读(1477) 评论(2) 推荐(2) 编辑

摘要:通过两种方法来实现:一、通过动态数组NSMutableArray中的数据,来显示数据1.新建Empty Application项目,新建ViewController,HomeViewController,在AppDelegate.m中导入该文件,并在方法- (BOOL)application:didFinishLaunchingWithOptions:中添加以下红色标记的代码- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ . 阅读全文

posted @ 2012-10-28 13:06 gavin.han 阅读(9875) 评论(0) 推荐(2) 编辑

摘要:在.m文件中修改方法- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation默认为竖屏:- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation != UIInterfaceOrientationPortrait);//竖屏}修改后为:- (BOOL)shouldAutorotateT. 阅读全文

posted @ 2012-10-27 16:12 gavin.han 阅读(216) 评论(0) 推荐(1) 编辑

摘要://slider控件值改变- (IBAction)sliderChanged:(id)sender { UISlider *slider = (UISlider *)sender;//用一个UISlider对象来接收sender int intValue = (int)(slider.value); NSString *strValue = [[NSString alloc] initWithFormat:@"%d",intValue];//将int 转化为NSString类型的一种方法 sliderLabel.text = strValue; [strValue rele 阅读全文

posted @ 2012-10-27 14:59 gavin.han 阅读(2261) 评论(0) 推荐(1) 编辑

摘要:方法一:在button按钮的点击事件中加上[self.textFiled resignFirstResponder];方法二:在xib文件中,可以不在View页面上添加一个View控件 ,一个简单的办法是将View页面的类设置为UIControl(该类继承与UIView).h文件:#import <UIKit/UIKit.h>@interface HomeViewController : UIViewController@property (retain, nonatomic) IBOutlet UITextField *nameField;@property (retain, n 阅读全文

posted @ 2012-10-27 12:46 gavin.han 阅读(263) 评论(0) 推荐(0) 编辑

摘要:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; // Override point for customization after application launch. self.window.backgroundColor = [U... 阅读全文

posted @ 2012-10-27 12:39 gavin.han 阅读(414) 评论(0) 推荐(0) 编辑

摘要:一、贴图为快玩法: 如果杀死10个僵尸,通过次关;点击进入下一关时,僵尸的速度变大。 如果家里进来15只僵尸,则输了,重玩此关。 点击杀死僵尸时播放音频,输赢也有音频播放,有背景音乐。二、业务逻辑及知识点1.主要由两个类来完成,类1:主页面显示类RootViewController:UIImageView;类2:僵尸类:ZombieView:UIImageView。2.播放音频类:#import <AVFoundation/AVAudioPlayer.h>,需要添加,NSString *deadPath = [[NSBundle mainBundle] pathForResourc 阅读全文

posted @ 2012-10-26 21:14 gavin.han 阅读(478) 评论(0) 推荐(0) 编辑

摘要:常用属性:frame,bounds和center重要方法 :addSubview 把一个子控件添加到一个父控件中;Superview 返回子控件的父控件常用函数:- (void)removeFromSuperview; - (void)insertSubview:(UIView *)view atIndex: (NSInteger)index; - (void)exchangeSubviewAtIndex: (NSInteger)index1 withSubviewAtIndex:(NSIn... 阅读全文

posted @ 2012-10-22 11:59 gavin.han 阅读(379) 评论(0) 推荐(0) 编辑

摘要:上面的通过代码实现:NSString *str = @"字符串大小字符串大小字符串大小字符串大小"; UIFont *font = [UIFont fontWithName:@"Arial" size:50.0f]; CGSize size = CGSizeMake(320, 2000); UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; [label setNumberOfLines:0]; CGSize labelSize = [str sizeWi... 阅读全文

posted @ 2012-10-22 11:46 gavin.han 阅读(252) 评论(0) 推荐(0) 编辑

摘要:1.新建一个Empty Application项目新建一个oc文件(UITableViewController),命名为:HomeViewController2.在HomeViewController.h中声明全局变量NSArray *dataArray;3.在HomeViewController.m中添加代码- (void)viewDidLoad{ [super viewDidLoad]; //数组的初始化 dataArray = [[NSArray alloc] initWithObjects:@"A",@"B",@"C",@&q 阅读全文

posted @ 2012-10-19 23:05 gavin.han 阅读(1233) 评论(0) 推荐(0) 编辑

摘要:1.新建Empty Applicationcommand+n,添加一个oc文件(UIViewController),命名为:HomeViewController2.在HomeViewController.h中声明全局变量 UIView *tView;3.在HomeViewController.m中://创建View的函数-(void) loadView{ [super loadView]; //创建View //UIView *tView; tView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100... 阅读全文

posted @ 2012-10-19 22:47 gavin.han 阅读(193) 评论(0) 推荐(0) 编辑

摘要:1.新建一个Empty Application程序修改文件appDelegate.m在方法- (BOOL)application::添加以下代码: //视图,hanjun tview = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)]; tview.backgroundColor = [UIColor redColor]; [self.window addSubview:tview]; //创建按钮 UIButton *btn = [UIButton buttonWithType:... 阅读全文

posted @ 2012-10-19 22:11 gavin.han 阅读(218) 评论(0) 推荐(0) 编辑

摘要:winform项目一、贴图为快二、源码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Threading;using System.Drawing.Drawing2D;namespace SimulatedClock{ /// <summary> /// a 阅读全文

posted @ 2012-10-18 22:39 gavin.han 阅读(272) 评论(0) 推荐(0) 编辑

摘要:winform应用程序一、贴图为快二、源码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;using System.Threading;namespace FilesplitDemo{ /// <summary> /// author:hanjun . 阅读全文

posted @ 2012-10-18 22:23 gavin.han 阅读(362) 评论(0) 推荐(0) 编辑

摘要:一.贴图为快二.知识点1.文本2.键盘1>自动隐藏,方法1:Did End on Exit事件,添加hideKeyboard方法,调用resignFirstResponder让让输入对象放弃其获取输入的权利; 方法2:(主要针对数字键盘)触摸背景来隐藏键盘。2>Keyboard属性,默认,Number Pad,Email Address等。3.按钮1>给按钮添加背景图片,在视图加载时设置,- (void)viewDidLoad{//在视图加载时设置按钮模板 UIImage *normalImage = [[UIImage imageNamed:@"whiteButt 阅读全文

posted @ 2012-10-18 11:40 gavin.han 阅读(312) 评论(0) 推荐(0) 编辑

摘要:TCP是TransmissionControlProtocol(传输控制协议)的简称,是TCP/IP体系中面向连接的运输层协议,在网络中提供全双工的和可靠的服务。TCP协议最主要的特点是:1)是一种基于连接的协议。2)保证数据准确到达。3)保证各数据到达的顺序与数据发出的顺序相同。4)传输的数据无消息边界。TCP协议通信流程:1.服务器端首先创建服务器套接字2.服务器套接字监听一个端口,等待客户端请求3.客户端创建客户端套接字4.客户端向服务器端发送连接请求5.服务器确认与客户端的连接6.客户端和服务器端利用建立的连接进行通信7.通信完毕后,客户端和服务器关闭各自的连接服务器和客户端利用Soc 阅读全文

posted @ 2012-10-16 11:16 gavin.han 阅读(852) 评论(0) 推荐(0) 编辑

摘要:世界不会在意你的自尊,人们看的只是你的成就。在你没有成就以前,切勿过分强调自尊。 ---比尔盖茨能够说出的委屈,便不算委屈;能够抢走的爱人,便不算爱人. 阅读全文

posted @ 2012-10-13 08:53 gavin.han 阅读(271) 评论(0) 推荐(1) 编辑

摘要:杭州某天使的内部邮件曝光,认为Web时代已经结束,抓住移动互联网的机会就看未来3年,所以投资的团队要尽快进入移动互联网。 大家对此怎么看?移动互联网的用户冰山会在未来3年内上浮1、今天的几千万总用户的移动互联网只是冰山一角,真正的冰山至少是10倍的量,这个冰山会在未来3年完成上浮。所以今天移动互联网上千万用户的这些大牛App,在3年后将再上升10倍。我估计三年后像xxx 这样的App,只要自己不犯大错,一定是轻易就会过千万的。2、整个上浮过程,会惊心动魄,移动互联网上会有自己的霸主群体!2、APP产品的特点是足够细分,所以有太多的地方存在创业空白点,大公司来不及布局,而且大象转身一定会比较慢。 阅读全文

posted @ 2012-10-13 08:52 gavin.han 阅读(216) 评论(0) 推荐(0) 编辑

摘要:可以自定义Titile的模板,具体XAML如下:<!--Panorama control--><controls:Panorama Title="my application"><controls:Panorama.Background><ImageBrush ImageSource="PanoramaBackground.png"/></controls:Panorama.Background><!--加入自定义标题字体--><controls:Panorama.TitleT 阅读全文

posted @ 2012-10-13 08:48 gavin.han 阅读(613) 评论(0) 推荐(0) 编辑

摘要: 阅读全文

posted @ 2012-10-13 08:46 gavin.han 阅读(226) 评论(0) 推荐(0) 编辑

摘要:通过自己自定义模板可以解决思路是把HyperlinkButton的Content属性设置为空 再定义ControlTemeplate在里面加一个TextBlock用于显示没有下滑线的文本<HyperlinkButton Height="30" HorizontalAlignment="Left" Margin="100,90,0,0" Name="hyperlinkButton2" ... 阅读全文

posted @ 2012-10-13 08:45 gavin.han 阅读(543) 评论(0) 推荐(0) 编辑

摘要:PhotoChooser中特殊的属性,首先是ShowCamera的属性,ShowCamera的属性是一个布尔型态,当设定为真时,在选择图片的画面中,会出现拍照的按钮,让使用者也可以透过照相机来做为图片的来源,会向下图的样子(您可以看到多出了应用程序栏中并且多了照相的按钮)接下来是PixelHeight,PixelWidth的属性,这两个属性是让使用者可以裁切原始的图形,比如说,现在应用程式要让使用者设定大头贴,大头贴的尺寸只需要100* 10,这时候过大的图形并没有用处,因此您就可以设定这两个属性,设定之后当使用者选定照片之后会出现裁切的方框,方框会依照您设定的长宽比例做调整,例如下方左图笔者 阅读全文

posted @ 2012-10-13 08:44 gavin.han 阅读(186) 评论(0) 推荐(0) 编辑

摘要:<ButtonGrid.Row="0"Grid.Column="0"BorderThickness="0"Width="200"Height="200"><Button.Background><ImageBrushImageSource="/Images/Main/hot.png"/></Button.Background><TextBlockText="热门应用"FontSize="22&q 阅读全文

posted @ 2012-10-13 08:43 gavin.han 阅读(261) 评论(0) 推荐(0) 编辑

摘要:<TextBoxText="请输入手机号"InputScope="TelephoneNumber"/> 阅读全文

posted @ 2012-10-13 08:42 gavin.han 阅读(227) 评论(0) 推荐(0) 编辑

摘要:publicvoidUpdate(stringstr){try{userDB=newUserDataContext(UserDataContext.DBConnectionString);vartables=userDB.UserTables.SingleOrDefault<UserTable>(x=>x.ID==1);if(tables!=null){tables.Name=str;}userDB.SubmitChanges();MessageBox.Show("修改姓名成功!");}catch{MessageBox.Show("数据库中表数据 阅读全文

posted @ 2012-10-13 08:41 gavin.han 阅读(162) 评论(0) 推荐(0) 编辑

摘要:对于稍复杂的数据的存储的json数据方法1:单独获取,有点麻烦方法2:全部获取到,使用方便 阅读全文

posted @ 2012-10-13 08:40 gavin.han 阅读(180) 评论(0) 推荐(0) 编辑

摘要: 阅读全文

posted @ 2012-10-13 08:32 gavin.han 阅读(192) 评论(0) 推荐(0) 编辑

摘要:方法1:MessageBox.Show("详细信息" + System.Environment.NewLine + "课程");方法2:MessageBox.Show("详细信息\r课程"); 阅读全文

posted @ 2012-10-13 08:31 gavin.han 阅读(1304) 评论(0) 推荐(0) 编辑

摘要:完成和取消按钮。这两个按钮的图标有默认的路径和名称,但程序中不会自动添加,需要我们手动来做:在项目中添加目录,名称为:Toolkit.Content找两张图标的图片,分别命名为:ApplicationBar.Cancel.png和ApplicationBar.Check.png,设置图片属性中的Bulid Action和Copy to Output Directory标签即可 阅读全文

posted @ 2012-10-13 08:29 gavin.han 阅读(297) 评论(0) 推荐(0) 编辑

摘要:1.在<phone:PhoneApplicationPage中写入BackKeyPress="PhoneApplicationPage_BackKeyPress"事件. 该事件在用户按下back实体键后触发.本身silverlight 没有程序退出机制,所以我们采用了龌龊抛异常的方法已达到退出应用程序目的2.实现这个PhoneApplicationPage_BackKeyPress事件 //退出应用 private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.C 阅读全文

posted @ 2012-10-13 08:26 gavin.han 阅读(215) 评论(0) 推荐(0) 编辑

摘要:两种常见错误导致以上错误!!!并且很难发现错误地方。1.导航代码 有误2.xaml页面有错误。如:margin 逗号写成了点号 阅读全文

posted @ 2012-10-13 08:24 gavin.han 阅读(135) 评论(0) 推荐(0) 编辑

摘要:/// <summary> /// 发送短信Task /// </summary> /// <param name="number"></param> /// <param name="smsBody"></param> public static void SmsTask(string smsBody) { SmsComposeTask smsComseTask = new SmsComposeTask() { Body... 阅读全文

posted @ 2012-10-13 08:21 gavin.han 阅读(209) 评论(0) 推荐(0) 编辑

摘要:1.贴图为快:2.核心知识(1)声明代码:@property (strong, nonatomic) IBOutlet UILabel *userOutput;@property (strong, nonatomic) IBOutlet UITextField *userInput;- (IBAction)setOutput:(id)sender;实现代码:@synthesize userOutput;@synthesize userInput;void)viewDidUnload{ [self setUserOutput:nil];//重要知识点,释放内存!!! [self ... 阅读全文

posted @ 2012-10-12 23:14 gavin.han 阅读(288) 评论(0) 推荐(1) 编辑

摘要:安装前准备:支持的操作系统Windows Vista需要安装SP2, 支持简易版本(Starter Edition)以上版本Windows 7 (x86和x64)支持简易版本(Starter Editon)以上版本(笔者使用的是Windows 7 (32bit)旗舰版本)硬件要求系统盘3GB以上的空间内在空间达到2GB或以上显卡要求如果需要开发XNA 游戏的话,需要具备Direct X10以上的显示卡,并且安装WDDM1.1驱动支持Direct X10以上的显卡主要用于Windows Phone模拟器GPU的加速安装逻辑:vs2010-->vs2010sp1-->Windows P 阅读全文

posted @ 2012-10-09 13:51 gavin.han 阅读(3896) 评论(0) 推荐(0) 编辑

摘要:MessageBoxResult res = MessageBox.Show("网络连接失败,请连接好网络再试!是否连接网络?", "提示", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { // } else { // } 阅读全文

posted @ 2012-10-09 13:32 gavin.han 阅读(877) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示