小编Ara*_*han的帖子

以编程方式解决Rubik的立方体

我正在尝试开发一个用C解决Rubik立方体的程序.我使用了回溯技术.这是一个非常漫长的过程,需要大量的迭代,所以我无法解决它.

请给我关于如何更有效地解决这个问题的建议 - 例如其他技术或采用回溯本身.在谷歌我找到了许多解决这个问题的捷径,但我不想通过使用快捷方式来解决这个问题.

c algorithm rubiks-cube

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

无法#import <Foundation/NSXMLDocument.h>

我将NSXMLElement在我的项目中使用,所以我试着

#import <Foundation/NSXMLDocument.h> 
Run Code Online (Sandbox Code Playgroud)

但它给出了一个错误:"没有这样的文件或目录." 我怎么能包括这个?

import objective-c ios nsxmldocument

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

double数据类型+ iphone

我有一个应用程序,我知道双倍的范围,**1.7E +/- 308 (15 digits).**但在我的应用程序中,我必须将文本框的值设置为100.0我的代码是

double value=[strPrice doubleValue]/100.0;
NSString *stramoount=[@"" stringByAppendingFormat:@"%0.2f",value ];
Run Code Online (Sandbox Code Playgroud)

当我将34901234566781212除以100它给我349012345667812.12但是当我键入 349012345667812124并且除以100它给我100它它给我3490123456678121.00 这是错误的我是否更改数据类型或如何更改我的代码

iphone double types

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

Facebook SDK 2.0的Facebook OAuth登录问题

我正在开发一个处理Facebook的iPhone应用程序.我使用最新的SDK facebook-facebook-ios-sdk-cf1c2c3(SDK 2.0)允许用户使用OAuth登录Facebook帐户.

用户可以在设备iPod Touch(4.3.1)中毫无问题地登录.但在iPhone 3GS中我收到以下错误:

Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be \u201cm.facebook.com\u201d which could put your confidential information at risk." UserInfo=0x1b8350 {NSErrorFailingURLStringKey=https://m.facebook.com/dialog/oauth?type=user_agent&display=touch&redirect_uri=fbconnect://success&sdk=2&scope=read_stream,publish_stream&client_id=<APP_ID>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSErrorFailingURLKey=https://m.facebook.com/dialog/oauth?type=user_agent&display=touch&redirect_uri=fbconnect://success&sdk=2&scope=read_stream,publish_stream&client_id=<APP_ID>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be \u201cm.facebook.com\u201d which could put your confidential information at risk., NSUnderlyingError=0x1b83a0 "The certificate …
Run Code Online (Sandbox Code Playgroud)

iphone sdk facebook login oauth

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

从iPhone相册导入和保存照片的正确方法是什么?

我正在将照片从iPhone相册导入到我的应用程序的文档文件夹中.这是我的代码.

for (int j=0; j<[assetArray count]; j++) {

    ALAsset *assest = [assetArray objectAtIndex:j];
    CGImageRef imageRef = assest.defaultRepresentation.fullResolutionImage;
    UIImage *image = [UIImage imageWithCGImage:imageRef];
    NSData *imageData = UIImageJPEGRepresentation(image);
    [imageData writeToFile:documentsPath atomically:YES];
}
Run Code Online (Sandbox Code Playgroud)

它工作正常,但当我尝试导入更高分辨率的图像时,它需要更多的时间.以最短时间导入的正确方法是什么?顺便说一下:转换image成转换需要更多时间NSData.

iphone objective-c ios writetofile alassetslibrary

3
推荐指数
2
解决办法
7892
查看次数

如何在选择日期后禁用UIDatePicker?

我使用以下代码为UIDatePicker,无论选择它的日期是在标签中显示.但是我需要在选择日期后关闭选择器.这可能请建议我.

我使用以下代码:

- (void)viewDidLoad {
    [super viewDidLoad];

    //Create label
    label = [[UILabel alloc] init]; 
    label.frame = CGRectMake(10, 10, 300, 40);
    label.textAlignment = UITextAlignmentCenter;

    //Use NSDateFormatter to write out the date in a friendly format
    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    df.dateStyle = NSDateFormatterMediumStyle;
    label.text = [NSString stringWithFormat:@"%@",
                  [df stringFromDate:[NSDate date]]];
    [df release];
    [self.view addSubview:label]; 
    [label release];

    // Initialization code
    datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 250, 325, 250)];
    datePicker.datePickerMode = UIDatePickerModeDate;
    datePicker.hidden = NO;
    datePicker.date = [NSDate date];
    [datePicker addTarget:self
                   action:@selector(changeDateInLabel:) …
Run Code Online (Sandbox Code Playgroud)

xcode uidatepicker ipad ios

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

如何在沙盒应用程序中添加quicklook生成器?

我为我的应用程序创建了一个QuickLook Generator,并Containers/com.Aravindh.EgApp/Data/Library/QuickLook/QuickLookGenerator.qlgenerator使用以下代码将quicklook生成器复制到此位置.

    NSString *path1 = [[NSBundle mainBundle] pathForResource:@"QuickLookGenerator" ofType:@"qlgenerator"];
    NSError *error;
    NSArray *paths = [[NSFileManager defaultManager] URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask];
    NSString *librayPath = [[paths objectAtIndex:0] path];
    librayPath = [NSString stringWithFormat:@"%@/Quicklook/QuickLookGenerator.qlgenerator",librayPath];
    if(![[NSFileManager defaultManager] fileExistsAtPath:librayPath]) {
        [[NSFileManager defaultManager] copyItemAtPath:path1 toPath:librayPath error:&error];
    }
Run Code Online (Sandbox Code Playgroud)

但是我收到了这个错误:

Error Domain=NSCocoaErrorDomain Code=513 "“QuickLookGenerator.qlgenerator” couldn’t be copied because you don’t have permission to access “QuickLook”." UserInfo=0x101518250 {NSSourceFilePathErrorKey=/Users/Aravindh/Desktop/EgApp/EgApp/build/Release/EgApp.app/Contents/Resources/QuickLookGenerator.qlgenerator, NSUserStringVariant=(
    Copy
), NSDestinationFilePath=/Users/Aravindh/Library/Containers/com.Aravindh.EgApp/Data/Library/Quicklook/QuickLookGenerator.qlgenerator, NSFilePath=/Users/Aravindh/Desktop/EgApp/EgApp/build/Release/EgApp.app/Contents/Resources/QuickLookGenerator.qlgenerator, NSUnderlyingError=0x10154dbb0 "The operation couldn’t be completed. Operation not permitted"}
Run Code Online (Sandbox Code Playgroud)

我是否必须在Entitlementes.plist中提及任何内容?如何在SandBox环境中安装QuickLookGenerator?

macos cocoa sandbox quicklook

2
推荐指数
1
解决办法
1168
查看次数

从xcode中的文本框中获取字符串

我是xcode的新手.我有一个字符串变量和一个文本框.我想从文本框中获取字符串到字符串变量.我怎样才能做到这一点?

iphone xcode objective-c

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

如何从rss字符串中提取图像源

This is the yahoo news rss feed
<p><a href="http://us.rd.yahoo.com/dailynews/rss/us/*http://news.yahoo.com/s/ap/20110521/ap_on_re_us/us_michelle_obama_west_point"><img src="http://d.yimg.com/a/p/ap/20110520/capt.53a8af4c675f421c8b7cba014c589d29-53a8af4c675f421c8b7cba014c589d29-0.jpg?x=130&y=97&q=85&sig=iOyBvkyg0rEKSK3hjlSsNA--" align="left" height="97" width="130" alt="First lady Michelle Obama, left, and Lt. Gen. David Huntoon, superintendent at the U.S. Military Academy, arrive in Washington Hall for a graduation banquet, Friday, May 20, 2011, in West Point, N.Y. (AP Photo/Mike Groll)" border="0" /></a>AP - First lady Michelle Obama urged more than 1,000 cadets Friday night on the brink of graduating to keep in mind the families of the soldiers they will lead.</p><br clear="all"/> …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c

0
推荐指数
1
解决办法
903
查看次数

这个printf是什么意思?

printf("%c","abcdefgh"[4]);
Run Code Online (Sandbox Code Playgroud)

以下程序的输出是e.但我不知道它是怎么回事?我在谷歌和这里搜索了很多,但没有找到这个代码的正确解释.我对此代码的解释如下:

"这只是为了获得一个char.即,第4个char开始0.所以答案是'e'".

c printf

0
推荐指数
1
解决办法
2043
查看次数