小编Osc*_*and的帖子

Cocos2d + Storyboards,我怎样才能获得一个有效的项目?

编辑: 接受/赏金给任何能告诉我如何制作项目的人:

  • 使用Cocos2d 2.x.
  • 有故事板
  • 有ARC
  • 如果您提供模板的下载链接,则可获得奖励

上一个问题变得一团糟,我自己已经解决了这个问题.如果有人想要制作更好的项目版本,赏金仍然可以争夺.

这是一个工作,清洁,随时可用的模板供任何人使用,完整的ARC,COCOS2D 2.1,故事板和一切

仅在iPhone上测试Xcode 4,5,iOS 6,7,但也应该在iPad上运行.

当我努力做到这一点时,我努力寻找这个,所以我希望我能帮助别人.对于自定义文件,可以使用Tiny Tim Games和/sf/answers/826075981/.我稍微修改了这些文件.新手的使用说明在项目自述文件中!:)

xcode interface-builder cocos2d-iphone ios uistoryboard

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

前缀属性后面必须跟有接口或协议栈溢出

[编译器错误]前缀属性后面必须跟有接口或协议栈溢出代码在前面工作正常。项目。我觉得自己像个白痴一样提出如此简单的问题。这东西有什么问题吗?

#import <UIKit/UIKit.h>
#import "FlipsideViewController.h"

@interface MainViewController : UIViewController <FlipsideViewControllerDelegate>
<UIPickerViewDelegate><UIPickerViewDataSource>

@property (strong, nonatomic) IBOutlet UITextField *inputText;
@property(strong, nonatomic) IBOutlet UIPickerView *picker;
@property(strong, nonatomic) IBOutlet UILabel *resultLabel;
@property(strong, nonatomic) NSArray *_convertFrom;
@property(strong, nonatomic) NSArray *_convertTo;
@property(strong, nonatomic) NSArray *_convertRates;
@property(strong, nonatomic) IBOutlet UILabel *formelLabel;
@property(strong, nonatomic) IBOutlet UITextField *inputText;


-(IBAction)textFieldReturn:(id)sender;
-(IBAction)backgroundTouched:(id)sender;


@end
Run Code Online (Sandbox Code Playgroud)

compiler-errors objective-c syntax-error ios xcode4.5

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

使用NSPredicate搜索NSMutableArray对象

问题解决了,这是我如何修复它以供将来参考像我 这样的noobs我需要删除白色空格: ship.countryOfbuild = [[elements objectAtIndex:0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

我不得不改变这样的谓词: NSPredicate *resultPredicate = [NSPredicate predicateWithFormat:@"(countryOfBuild contains[cd] %@) OR (shipBuilder contains[cd] %@) OR (name contains[cd] %@) OR (owner contains[cd] %@)",searchText, searchText, searchText, searchText];

原始问题

我正在使用本教程向我的项目添加搜索栏.我让tableview全部工作,但搜索功能正在崩溃应用程序.我现在搜索的方式是:

-(void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
NSPredicate *resultPredicate = [NSPredicate
                                predicateWithFormat:@"SELF contains[cd] %@",
                                searchText];

searchResults = [searchContent filteredArrayUsingPredicate:resultPredicate];
}
Run Code Online (Sandbox Code Playgroud)

searchContent是一个从.csv文件读取的可变数组,如下所示:

- (void)viewDidLoad
{
[super viewDidLoad];
NSString* pathToFile = [[NSBundle mainBundle] pathForResource:@"ships" ofType: @"csv"];

NSString *file = [[NSString alloc] initWithContentsOfFile:pathToFile encoding:  NSUTF8StringEncoding error:NULL];

NSArray *allLines …
Run Code Online (Sandbox Code Playgroud)

objective-c nspredicate ios

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

在UIWebView中的本地HTML文件中加载本地映像

我在这里尝试了很多其他答案,但我似乎无法想出这一点.我有一个嵌入一些本地图像的本地HTML文件.

我的文件夹结构是:

assets
>html
>>*.html
>>*.html
>>*.html
>media
>>*.jpeg
>>*.jpeg
>>*.jpeg
Run Code Online (Sandbox Code Playgroud)

我用HTML请求图像

<img src="../media/sjolyst.jpg" alt="Sjølyst"/>
Run Code Online (Sandbox Code Playgroud)

我加载Web视图的代码非常简单,

var path = NSBundle.mainBundle().pathForResource(htmlFileName, ofType: "html")!
let data: NSData = NSData(contentsOfFile:path)!
var html = NSString(data: data, encoding:NSUTF8StringEncoding)

detailWebView.loadHTMLString(html as! String, baseURL: NSBundle.mainBundle().bundleURL)
Run Code Online (Sandbox Code Playgroud)

这似乎与我在SO上看到的所有答案相同.不过,它呈现如下: :( 我该如何解决这个问题?

uiwebview ios swift

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

当CLRegions重叠时,地理围栏的行为如何

我似乎无法找到有关Core Location如何处理重叠地理围栏的任何信息.在我的特殊情况下,我想知道是否会在较大的重叠区域注册较小的地理围栏.有人知道吗?

core-location ios geofencing clregion

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

如何识别屏幕高五

我有一个客户想要识别用户用他们的整个手牌,如高五.我怀疑苹果不会批准这一点,但让我们远离那个.

我虽然使用了四指点击识别器,但这并没有真正涵盖它.最好的方法可能是用手检查用户是否覆盖了至少70%的屏幕,但我不知道该怎么做.

有人可以帮帮我吗?

uigesturerecognizer ios swift

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

Apple LLVM编译器错误4.1

所以,我碰巧移动了一些文件夹,突然间我的项目认为它很酷,只是喜欢,而不是工作.有人可以告诉我如何解决这个错误?(编译irl iphone时出错.)

短错误:

clang: error: no such file or directory: '/Users/OscarApeland/Downloads/LNG Converter 2/LNG Converter/LNG Converter/LNG Converter-Prefix.pch'
clang: error: no input files
Command/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
Run Code Online (Sandbox Code Playgroud)

完整错误:

ProcessPCH "/Users/OscarApeland/Library/Developer/Xcode/DerivedData/LNG_Converter-fhuumyzhzihyzkcrahggbbgzeijr/Build/Intermediates/PrecompiledHeaders/LNG Converter-Prefix-chblhzzekvnqprcbihkzfysqbmqa/LNG Converter-Prefix.pch.pth" "LNG Converter/LNG Converter-Prefix.pch" normal armv7s objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Users/OscarApeland/Downloads/LNG Converter 2/LNG Converter"
setenv LANG en_US.US-ASCII
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c-header -arch armv7s -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wduplicate-method-match -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow …
Run Code Online (Sandbox Code Playgroud)

xcode compiler-errors llvm ios

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

MKAnnotation子类问题

我昨晚升级到Swift 1.2,我得到了一个我真想不通的bug.以下代码在之前版本的Xcode和Swift中运行良好.

//MARK: Annotation Object
class PointAnnotation : NSObject, MKAnnotation {
    var coordinate: CLLocationCoordinate2D
    var title: String
    var subtitle: String
    var point: Point
    var image: UIImage
    var md: String

    init(point: Point) {
        self.coordinate = point.coordinate
        self.title = point.title
        self.subtitle = point.teaser
        self.image = UIImage(named: "annotation.png")!
        self.point = point
        self.md = point.content
    }
}
Run Code Online (Sandbox Code Playgroud)

在第3行,我得到了一些有点难以理解的错误 Objective-C method 'setCoordinate:' provided by the setter for 'coordinate' conflicts with the optional requirement method 'setCoordinate' in protocol 'MKAnnotation'我尝试更改变量名称等,但没有帮助.有谁知道如何解决这个问题?

该课程用于我的mapview上的注释.

xcode mapkit mkannotation ios swift

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

"重复符号"链接器错误没有明显原因

Duplicate symbols在链接我的项目时看到了.我不知道这意味着什么,也不知道如何解决它,所以任何帮助都将不胜感激.

因为shipNameText似乎是错误的来源,所以我在这里使用它:在.h中:

@property (strong,nonatomic)IBOutlet  UILabel *shipNameText;
Run Code Online (Sandbox Code Playgroud)

在.m

@interface boatInfoViewController ()

@end

@implementation boatInfoViewController
@synthesize shipNameText, shipSizeText;


- (void)viewDidLoad
{
    [super viewDidLoad];
    NSUserDefaults *shipName = [NSUserDefaults standardUserDefaults];
    NSUserDefaults *shipSize = [NSUserDefaults standardUserDefaults];
    NSString *name = [[NSUserDefaults standardUserDefaults]
                                 objectForKey:@"shipName"];
    NSString *size = [[NSUserDefaults standardUserDefaults]
                      objectForKey:@"shipSize"];
    shipNameText.text = name;
    shipSizeText.text = size;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

xcode compiler-errors objective-c ios

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

在Swift中生成多页PDF

UIImage想要制作一个长的多页PDF文件,每页只有一个图像.我已经把每个图像都放到了由NSData表示的PDF中,但是我很难找到关于如何将它们组合成一个长文档的任何信息.

我当前的代码如下所示:

 //Convert images to pdf
    var pdfDatas = [NSData]()
    for image in images {
        let pdfData = NSData.convertImageToPDF(image)

        pdfDatas.append(pdfData!)


    }
    //Combine PDF's to one long document here. 
Run Code Online (Sandbox Code Playgroud)

有谁知道如何实现这一目标?

pdf nsdata ios swift

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