可怜的小狗狗

可怜的小狗狗,还没开眼就被人遗弃,被偶一个好心的同事捡到收养了,也算有了归属.上图图:




附带一奶瓶,由此可见主人也不是很残忍,那为什么要遗弃呢?

[转]Converting iPhone Apps to Universal Apps

很棒的一篇关于Universal程序的心得,原文地址:http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html
(需翻墙)

Well, the NDA has finally lifted, so we can start talking about iPhone SDK 3.2 and the iPad. The logical starting place seemed to be how to convert your existing applications into a “Universal App” that runs natively both on the iPad and the iPhone/iPod touch. Now, a lot of you have likely already had to figure this stuff out so you could get your updated app on the[......]

继续阅读

Socket communication on the iPhone/iPad

Some information on socket implementation on the iPhone, because I’ve found no information on the web and think this could be useful for others as well. Caution: More often than not you only want to get the contents of an URL, for this simply use the following:

NSString *someString = [NSString stringWithContentsOfURL:(NSURL *)url];

But if you in fact want to connect low level to a socket and read/write the bytes themselves you can get it running like this:

// This will be the read stream.
C[......]

继续阅读

iPad类似Setting程序,竖屏SplitView小demo

竖屏SplitView,类似系统的setting程序,一个demo。
看到cc很多人在问,发下。

效果:

相关讨论:

http://www.cocoachina.com/bbs/read.php?tid-25636-page-1.html

这个讨论内容可能用的上(右边多个控制器相关):

http://www.cocoachina.com/bbs/read.php?tid-24466.html

源码demo:
下载

TCP中connect加入的超时控制

最近写iPad下iWebmaster中portscan用到的,备份记录下,大致核心部分如下:

在使用TCP的connect连接服务器时,在默认情况下系统使用的是阻塞式socket,如果服务器当前不可用,则connect会等待知道超时时间到达,而这个超时时间是系统内核规定的,并不能使用setSocketOpt来设置,这个函数只能设置send和recv的超时,为了能够随意控制connect的超时时间,可以使用select。大致的过程就是先将socket设置成非阻塞,使用select去轮询套接口,再根据套接口去判断连接状态。

int flag;
    
flag = fcntl(sock,F_GETFL,0);
    
flag |= O_NONBLOCK;
    
fcntl(sock,F_SETFL,flag);//设置非阻塞
    
if (type == SOCK_STREAM) {
        
int ret = -1;[......]

继续阅读

我会一直用心做好产品,做好服务的

偶的生活查询for iPad 上线3天登上了中国区付费棒首,小小的祝贺一下.我会一直用心做好产品,做好服务的,感谢Apple,感谢AppStore,感谢所有Apple fans.

生活查询for iPad
生活查询for iPhone

不同控制器之间通信的一个好方法

首页在view1的控制器初始化init方法里加上观察者模式方法:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reloadChat:)
name:@”reloadChat” object:nil];

-(void)reloadChat:(id)sender{}


在view2里的button添加用来触发view1的reloadChat方法:

[[NSNotificationCenter defaultCenter] postNotificationName:@”reloadChat” object:self];

—END—

一代二代iPhone千万别升级到iOS4.0,警惕!!!!

偶二代机器就是一个活生生的例子,升级后卡的滴血.偶现在每天都运行在安全模式,正常模式放个音乐都卡的吐血……

后台运行就是个大垃圾,还没以前的插件好用…..

痛苦……
痛苦……
鸡肋……
鸡肋……
纠结……[......]

继续阅读

没有ipad,发布真机截图的几个方法

1.CTRL+COMMAND+C,然后在Preview里New from clipboard(不带边框,推荐)

2.cmd+shift+4,这时按下空格就会出现相机窗口选择,点一下模拟器就可以(带边框)

iPhone的九宫格实现代码

看到CocoaChina很多同学在问,其实很简单,我这是用图片堆砌实现的九宫格,分享如下:

效果图:

核心就这2个方法:

//Power by ieliwb.com
-
(void)viewDidLoad {
    
[super viewDidLoad];
    
    
NSArray* imageNames = [NSArray arrayWithObjects:
                                        @
"ico_mobile.png",
                           [......]

继续阅读