我正在将这个NSURLConnection与代表一起使用.
nsconnection = [[NSURLConnection alloc] initWithRequest:request
delegate:self startImmediately:YES];
Run Code Online (Sandbox Code Playgroud)
问题是网站根本没有回应.没什么,只是在浏览器中旋转空白页面,没有失败.在我的代表中,我处理失败,但当网站没有响应时,代表不会被调用.有关如何超时连接的任何想法?
如果我这样做:
@interface RegisterController : UIViewController <UITextFieldDelegate>
{
IBOutlet UITextField *usernameField;
}
Run Code Online (Sandbox Code Playgroud)
而不是这个:
@interface RegisterController : UIViewController <UITextFieldDelegate>
{
UITextField *usernameField;
}
@property (nonatomic, retain) IBOutlet UITextField *usernameField;
Run Code Online (Sandbox Code Playgroud)
会发生什么坏事吗?我知道在第二种情况下,该字段被保留,但是由于笔尖拥有该字段,这是否会有所不同?没有保留,这个领域会消失吗?在什么情况下?第一种情况下的代码工作,想知道这是否是内存管理方面的问题.
我想从iPhone获得实时视频到另一台设备(桌面浏览器或其他iPhone,例如点对点).
注意:这不是一对多,而是目前只有一对一.音频可以是流的一部分或通过iphone上的电话呼叫.
我能想到的方法有四种......
在iPhone上捕获帧,将帧发送到mediaserver,让mediaserver使用主机webserver发布实时视频.
在iPhone上捕获帧,转换为图像,发送到httpserver,在浏览器中使用javascript/AJAX尽快从服务器重新加载图像.
在iPhone上运行httpServer,在iPhone上捕获1秒持续时间的电影,在iPhone上创建M3U8文件,让另一个用户直接连接到iPhone上的httpServer以进行liveStreaming.
在iPhone上捕获1秒持续时间的电影,在iPhone上创建M3U8文件,发送到httpServer,让其他用户连接到http服务器以进行liveStreaming.这是一个很好的答案,有没有人得到它的工作?
有更好,更有效的选择吗?从iPhone上获取数据的最快方法是什么?是ASIHTTPRequest吗?
感谢大家.
我在方法中有以下代码.当我在模拟器中运行它时,调试器跳过代码?我错过了什么?
if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) ||
([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight))
{
} else {
}
Run Code Online (Sandbox Code Playgroud) UIScrollView包含几个UIView对象; 如何判断屏幕上没有触摸生成的点是否在滚动视图的特定子视图内?到目前为止,尝试确定点是否在子视图中总是返回父滚动视图的子视图数组中的第一个子视图,即坐标是相对于滚动视图而不是窗口.
这是我尝试过的(编辑过的)
-(UIView *)viewVisibleInScrollView
{
CGPoint point = CGPointMake(512, 384);
for (UIView *myView in theScrollView.subviews)
{
if(CGRectContainsPoint([myView frame], point))
{
NSLog(@"In View");
return myView;
}
}
return nil;
}
Run Code Online (Sandbox Code Playgroud) 我在UIScrollView上有四个UIViews(屏幕分为四分位数)
在四分位数上,我在每个四分位数上有一些对象(UIImageViews).
当用户点击屏幕时,我想找到与给定CGPoint最近的对象?
有任何想法吗?
我有每个四分位数内的对象的CGPoint和框架(CGRect).
更新:
hRuler http://img.skitch.com/20100824-c333thq3rjcak9f5q5djjugjhw.preview.jpg // UIScrollView
NSLog(@" UIScrollView: %@", self);
// Here's the tap on the Window in UIScrollView's coordinates
NSLog(@"TapPoint: %3.2f, %3.2f", tapLocation.x, tapLocation.y);
// Find Distance between tap and objects
NSArray *arrayOfCGRrectObjects = [self subviews];
NSEnumerator *enumerator = [arrayOfCGRrectObjects objectEnumerator];
for (UIView *tilesOnScrollView in enumerator) {
// each tile may have 0 or more images
for ( UIView *subview in tilesOnScrollView.subviews ) {
// Is this an UIImageView?
if ( [NSStringFromClass([subview class]) …Run Code Online (Sandbox Code Playgroud) 这就是我想要做的.
用户(a):在两个字段(描述-1)和(描述-2)中输入数据.
用户(b)在相反的字段中输入类似的数据.
用户(a)或(b)在两个字段上搜索都会找到匹配项.
一个很好的类比是约会搜索.用户(a)输入他们自己的描述和他们正在寻找的匹配,并且用户(b)输入他们自己的描述和他们正在寻找的匹配,并且两者将能够进行搜索并找到匹配.
所以在psuedo查询英文...
从数据中选择名称,其中me ='target'和target ='me'
问题是,该领域的一些词语将匹配,但不是全部.
数据库创建得很好,插入工作正常.我遇到下面的select语句有问题.它不返回任何记录,也没有错误.任何其他字段上的选择工作正常.谁能发现我做错了什么?
"create table if not exists data (pkey integer primary key, doc date)"
[db executeUpdate:@"insert into data ( doc) values (?)" , [NSDate date]];
"select * FROM data WHERE doc between '2009-08-23' and '2009-08-23' "
Run Code Online (Sandbox Code Playgroud) 我正在绘制代码以擦除部分图像.我不是CoreGraphics的专家,可以使用一些帮助.
这个例程工作正常,但是,当快速移动时,它会失去触摸(不是很平滑).可以修改此例程以使CGContextClearRect更流畅吗?有更好,更快的方法吗?
-(void)drawRect:(CGRect)rect {
if (!myDrawing) { // touchpoints stored here
myDrawing = [[NSMutableArray alloc] initWithCapacity:0];
}
UIGraphicsBeginImageContext(frontImage.frame.size);
[frontImage.image drawInRect:CGRectMake(0, 0, frontImage.frame.size.width, frontImage.frame.size.height)];
if ([myDrawing count] > 0) {
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5);
CGContextSetLineCap(UIGraphicsGetCurrentContext(),kCGImageAlphaNone );
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1, 0, 0, 10);
for (int i = 0 ; i < [myDrawing count] ; i++) {
NSArray *thisArray = [myDrawing objectAtIndex:i];
if ([thisArray count] > 2) {
float thisX = [[thisArray objectAtIndex:0] floatValue];
float thisY = [[thisArray objectAtIndex:1] floatValue];
CGContextBeginPath(UIGraphicsGetCurrentContext());
for (int j = 2; …Run Code Online (Sandbox Code Playgroud) 为了澄清,我想检查有效字符.对于名字,姓氏我想检查[A-Za-z].对于电子邮件,我想检查有效的电子邮件字符.
我会用什么算法来检查用户输入?具体来说,在添加到数据库之前,我想检查用户的有效字符的名字,姓氏和电子邮件地址.
显然,这样的事情是不够的:
if ( [firstName.text isEqualToString:@""] || [lastName.text isEqualToString:@""] || [emailAddress.text isEqualToString:@""]) { ... }
Run Code Online (Sandbox Code Playgroud)