2010
Jul
29
文章类别:iPhone开发1、联机调试时需要修改项目的get info和Targets的get info中的KEY,plist的Bundle identifier值;
2、有Sec类跳转到Third类的方法:
在 Sec.m中添加#import "Third.h";
再添加:
- - (IBAction)gotoSec:(id) sender{
- NSString *viewControllerName = @"Third";
- Third *viewController = [[NSClassFromString(viewControllerName) alloc] initWithNibName:viewControllerName bundle:nil];
- [self.view addSubview: viewController.view];
- }
3、让图片滚动:
将uiimageview放在scroll view里面,设置scroll view的插座变量并设置其代理,
加入代 码scrollview.contentSize = CGSizeMake(400,600);
4、让图片缩放:
在上一个的基础上设置uiimage view的插座变量,在scroll view的属性中调整最大放大和最小缩小的值,加入如下函数(
- -(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
- if(scrollView==scrollview)
- return imgview;
- return FALSE;
- }
5、函数返回的如果是指针类型则使用自动释放池:return
6、UIWebView的使用方法:
- [webview setOpaque:NO];
- [webview setBackgroundColor:[UIColor clearColor]];
- NSString *HTMLData = @"<img src=\"http://image.17173.com/bbs/upload/2006/04/06/1144319556.gif\" alt=\"picture\" width=\"306\"/>";
- [webview loadHTMLString:HTMLData baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];
7、UIImageView使用web图片:
- UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://farm4.static.flickr.com/3092/2915896504_a88b69c9de.jpg"]]];
8、UITableViewCell自定义选中背景:
- cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellart.png"]] autorelease];
- 字体颜色:
- cell.textLabel.highlightedTextColor = COOKBOOK_PURPLE_COLOR;
8、Loading的用法:
- - (void)viewDidLoad {
- [self.view addSubview:loadingview];
- [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(loading) userInfo:nil repeats:NO];
- [super viewDidLoad];
- }
- - (void)loading {
- [loadingview removeFromSuperview];
- }
9、输入框点击done返回:
- 一、self.idinput.returnKeyType = UIReturnKeyDone;
- 二、然后设置按钮的代理;
三、
- -(BOOL)textFieldShouldReturn:(UITextField *)theTextField {
- [theTextField resignFirstResponder];
- return YES;
- }
10、alert的使用:
- UIAlertView *alertstart = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Easy",@"Medium",@"Hard",nil];
- [alertstart show];
- //弹出层选择
- - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
- if(buttonIndex == 0){ //取消
- stage = 0;
- }else{
- if(buttonIndex == 1){ //中等
- mainstageviewcontroller.gamelevel = 0;
- }else if(buttonIndex == 2){ //困难
- mainstageviewcontroller.gamelevel = 1;
- }else if(buttonIndex == 3){ //取消
- mainstageviewcontroller.gamelevel = 2;
- }
- [alertView release];
- }
本站原创,转载请标明:来自追梦博客(http://www.wuleilei.com/)
iPhone initWithFrame: reuseIdentifier: is deprecated的解決方法 (2010-08-25)
iPhone开发笔记(二) (2010-07-31)
iPhone开发之显示WiFi提示 (2010-07-23)
iPhone开发之全局变量的使用 (2010-07-21)
iPhone开发之UIWebView的使用方法 (2010-07-15)
个人日记 (74)
开发相关 (20)
域名+空间 (14)
XHTML相关 (17)
iPhone开发 (8)
PHP+MySQL (26)
建站相关 (25)
影视音乐 (12)
琐碎收藏 (10)
2010年09月 (2)
2010年08月 (7)
2010年07月 (11)
2010年06月 (11)
2010年05月 (13)
2010年04月 (11)
2010年03月 (12)
2010年02月 (8)
2010年01月 (14)
2009年12月 (18)
2009年11月 (23)
2009年10月 (21)
2009年09月 (16)
2009年08月 (6)
2009年07月 (5)
2009年06月 (28)


标签:
踏雪残情
2010-07-29 19:49:31