小编cho*_*ise的帖子

iPhone模拟器3.2(iPad)中的核心位置

所以,

我正在尝试将我的应用移植到iPad.我正在使用CoreLocation.

苹果说iPad确实有

Location:
Wi-Fi
Digital compass
Assisted GPS (Wi-Fi + 3G model)
Cellular (Wi-Fi + 3G model)
Run Code Online (Sandbox Code Playgroud)

所以应该有可能得到我的ipad(至少有3g模型)大约3公里半径的位置.

但它在模拟器(3.2 ipad)中无效(在模拟器中运行3.1.3模拟我cupertino).

有没有办法在模拟器中获得位置(3.2 ipad)?我住在德国,这里的ipad尚未发布,所以我无法在我的设备上测试它.

谢谢!

编辑

多数民众赞成我如何试图获得我的联系

locationManager = [[CLLocationManager alloc] init];
locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers;
locationManager.delegate = self;
[locationManager startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)

并且总是在3.2上locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error被调用.不是3.1.3

错误对象如下所示:

Error Domain=kCLErrorDomain Code=0 "Operation could not be completed. (kCLErrorDomain error 0.)"
Run Code Online (Sandbox Code Playgroud)

编辑

所以我处理了这样的事情:

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {

    #ifdef TARGET_IPHONE_SIMULATOR
    // Cupertino
    CLLocation *simulatorLocation = [[CLLocation alloc] initWithLatitude:37.33168900 longitude:-122.03073100];
    [self locationManager:locationManager didUpdateToLocation:simulatorLocation fromLocation:nil]; …
Run Code Online (Sandbox Code Playgroud)

iphone core-location ipad ios ios-simulator

6
推荐指数
1
解决办法
6769
查看次数

simpleXML的替代方法,用于使用PHP解析xml文件

我只是想知道是否有任何替代simpleXML用于使用PHP解析XML数据.

例如,如果没有加载simpleXML模块,或者即使有一个lib/class,那么它具有比SimpleXML更好的性能.

php xml simplexml

5
推荐指数
1
解决办法
1万
查看次数

NSLocale - 获取所有可用语言

有没有办法让iphone上的所有可用语言就像在设置应用程序中一样?

在NSLocales类参考中找不到方法.

谢谢!

alt text http://dl.getdropbox.com/u/80699/Bildschirmfoto%202010-07-26%20um%2019.45.49.png

iphone objective-c

5
推荐指数
1
解决办法
5045
查看次数

将相对URL更改为绝对URL

例如,我有一个像这样的字符串:

$html = '
            <a href="test.html">test</a>
            <a href="http://mydomain.com/test.html">test</a>
            <a href="http://otherdomain.com/test.html">test</a>
            <a href="someothertest/otherdir/hi.html">hi</a>
        ';
Run Code Online (Sandbox Code Playgroud)

我想将绝对网址附加到没有给出绝对域名的所有hrefs.

$html = '
            <a href="http://mydomain.com/test.html">test</a>
            <a href="http://mydomain.com/test.html">test</a>
            <a href="http://otherdomain.com/test.html">test</a>
            <a href="http://mydomain.com/someothertest/otherdir/hi.html">hi</a>
        ';  
Run Code Online (Sandbox Code Playgroud)

最好的方法是什么?我猜RegEx的东西,但我的RegEx技能是**;)

提前致谢!

php regex url hyperlink

5
推荐指数
1
解决办法
1万
查看次数

动画点多次,更自然

所以我当前的版本看起来像这样:动画电影

我对核心动画很新,所以我试图实现的是有多个点,比如当前的一个,从左侧框中以各种角度,高度和速度移出它,就像一个网球机.

在此输入图像描述

第一个问题是,我的"球"看起来不像是从重力中被抓住了,而且最初的速度还不够快.

另外,如何通过开始之间的距离变化多次执行此动画.

如果有什么不清楚,请发表评论.

我目前的代码:

- (void)loadView {
    [super loadView];

    self.view.backgroundColor = [UIColor lightGrayColor];   

    CGPoint startPoint = CGPointMake(20, 300);
    CGPoint endPoint = CGPointMake(300, 500);

    UIBezierPath *trackPath = [UIBezierPath bezierPath];
    [trackPath moveToPoint:startPoint];
    [trackPath addQuadCurveToPoint:endPoint controlPoint:CGPointMake(endPoint.x, startPoint.y)];

    CALayer *point = [CALayer layer];
    point.bounds = CGRectMake(0, 0, 20.0, 20.0);
    point.position = startPoint;
    point.contents = (id)([UIImage imageNamed:@"point.png"].CGImage);
    [self.view.layer addSublayer:point];

    CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    anim.path = trackPath.CGPath;
    anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    anim.repeatCount = HUGE_VALF;
    anim.duration = 2.0;
    [point addAnimation:anim forKey:@"movepoint"];

    CALayer *caseLayer …
Run Code Online (Sandbox Code Playgroud)

iphone animation core-animation objective-c ios

5
推荐指数
1
解决办法
1199
查看次数

flickr API调用

我感兴趣的是每秒或每分钟可以使用我的flickr API密钥进行多少次api调用?

有限制还是无限制?

flickr call api-key

4
推荐指数
1
解决办法
1001
查看次数

Wordpress - 在页面和帖子之外使用评论系统

所以目前我正在使用pods为日志创建一些单独的页面,其中包含自定义内容.

现在我想为每个页面使用评论系统,例如:

mydomain.com/podpages/page1
mydomain.com/podpages/page2
mydomain.com/podpages/page3
Run Code Online (Sandbox Code Playgroud)

不是使用wordpress创建的页面,因此简单地添加<?php comments_template(); ?>不起作用.

任何想法如何解决这个问题?提前致谢

如果有什么不清楚请发表评论:)

php wordpress comments podscms

4
推荐指数
1
解决办法
1125
查看次数

在uiwebview中播放本地视频

我将本地html文件加载到ipad应用程序中:

NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
NSString *path = [[NSBundle mainBundle] pathForResource:@"lieferant1" ofType:@"html"];
NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:content baseURL:baseURL];
Run Code Online (Sandbox Code Playgroud)

显示网页,我的html文件的内容:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum …
Run Code Online (Sandbox Code Playgroud)

video html5 objective-c uiwebview ipad

4
推荐指数
1
解决办法
4243
查看次数

在推送UINavigationController时动画UIView

以下情况.我有一个使用UINavigationController进行导航的应用程序.

对于推送特殊导航控制器,我想要一个自定义动画,缩小.我到目前为止看起来很好,唯一的问题是,"旧的"Viewcontroller在动画开始之前就消失了,所以新的viewcontroller缩小了"nothing"而不是在后台查看旧的viewcontroller.

为了更好地观看我创建了一个简单的示例应用程序:下载

在此输入图像描述在此输入图像描述在此输入图像描述

有没有人知道,如何动画新的视图控制器(image3),旧的视图控制器(image1)在动画(图像2)时留在后台?

/* THIS CANNOT BE CHANGED */
    AnimatedViewController *animatedViewController = [[AnimatedViewController alloc] initWithNibName:@"AnimatedViewController" bundle:nil];

    /* THIS CAN BE CHANGED */
    animatedViewController.view.transform = CGAffineTransformMakeScale(0.01, 0.01);
    [UIView beginAnimations:@"animationExpand" context:NULL];
    [UIView setAnimationDuration:0.6f];
    animatedViewController.view.transform=CGAffineTransformMakeScale(1, 1);
    [UIView setAnimationDelegate:self];
    [UIView commitAnimations];

    /* THIS CANNOT BE CHANGED */
    [self.navigationController pushViewController:animatedViewController animated:NO];
Run Code Online (Sandbox Code Playgroud)

其他信息:我的应用程序并不那么简单.我为我的应用程序使用了three20框架,但视图控制器的推送和创建就是three20所做的.我只能挂钩(THIS CAN BE CHANGED在我的代码中)之间的部分.我无法在此之前和之后更改代码(除非经过大量研究).

iphone animation uiviewcontroller uinavigationcontroller ios

4
推荐指数
1
解决办法
2709
查看次数

在OSX Startup上启动独角兽

我目前正在osx lion下使用rvm和unicorn进行服务器管理.我也使用gemset.

所以为了启动我的服务器我做以下事情:

cd /xyz/project
unicorn -c /xyz/project/config/unicorn.rb -E production
Run Code Online (Sandbox Code Playgroud)

现在我希望这台服务器在我的电脑启动时启动.我读了一些关于添加一个plist文件~/Library/LaunchAgents/并激活它的东西,launchctl但我不知道在这个plist文件中写什么来启动我的服务器.

有任何想法吗?我认为这很困难,因为宝石需要通过cd进入这个目录来激活.

谢谢你的帮助.

ruby macos ruby-on-rails unicorn

3
推荐指数
1
解决办法
3352
查看次数