我已经有一个iPhone应用程序将数据存储在本地文档文件夹中的文件中.现在我了解了iCloud技术,我的第一个问题是:当有时我检查新版本时,有没有办法将iCloud用作目录?
我的意思是:我可以避免使用UIDocument,文件协调员和文件演示者吗?我只想知道是否可以将iCloud视为特殊文件夹,只使用NSFileManager来推送和检索文件.
最后注意:我不使用Core Data或任何数据库,我只有一个数据文件.
编辑:
我已经阅读了官方的Apple iCloud文档,所以不要将我链接到他们.我只需要一些代码示例.
如何编写我的.plist文件的CFBundleDocumentTypes属性,以允许应用程序显示在其他应用程序的"Open in ..."对话框中?
这是我的,但它不起作用
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>Readings</string>
<key>LSItemContentTypes</key>
<array>
<string>text.csv</string>
</array>
</dict>
</array>
Run Code Online (Sandbox Code Playgroud) 有什么区别:
myBarButtonItem.enabled = NO;
Run Code Online (Sandbox Code Playgroud)
和
myBarButtonItem.userInteractionEnabled = NO;
Run Code Online (Sandbox Code Playgroud)
按钮每次都变灰吗?
我按照Apple Docs NSMetadataQuery中的描述使用来搜索我的iCloud文件.我只有一个文件,我知道它的名字.我的问题是,有时这个文件不存在(我想因为它尚未下载),NSMetadataQuery无法找到它.
曾试图强行下载,NSFileManager startDownloadingUbiquitousItemAtURL:error:它给我一个错误.(阅读编辑)
我的解决方案是我第一次创建文件,然后我猜它存在,我用UIDocument打开它.但它可能不存在,或者可能是用户第一次打开应用程序.我无法确定这些事情.我的第一个问题是:如果UIDocument打开文件,则意味着它在某个地方找到了该文件.如果它不存在,它怎么能使用该文件?
然后,第二个问题:如果我的应用程序必须管理多个文件或名称未知的文件.如果NSMetadataQuery不起作用,我怎么能找到它们.
编辑:
如果startDownloadingUbiquitousItemAtURL应该用于开始下载文件,我怎么知道文件何时完成下载(可能有通知)?但是,更重要的是:如果总是说(删除原始名称),我如何下载文件?
Error Domain=NSPOSIXErrorDomain Code=2 "The operation couldn’t be completed.
No such file or directory" UserInfo=0x166cb0 {
NSDescription=Unable to get real path for Path
'/private/var/mobile/Library/Mobile Documents/teamid~com~team~app/Documents/file.extension'
}
Run Code Online (Sandbox Code Playgroud) 我将UITableViewCell子类化为将单元格背景颜色设置为我需要的颜色:
.H
@interface DataViewCustomCell : UITableViewCell {
UIColor* cellColor;
UIColor* standardColor;
}
- (void) setCellColor: (UIColor*)color;
@end
Run Code Online (Sandbox Code Playgroud)
.M
@implementation DataViewCustomCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void) setCellColor: (UIColor*)color
{
cellColor = color;
}
- (void) spreadBackgroundColor: (UIView*)that withColor: (UIColor*)bkColor
{
NSEnumerator *enumerator = [that.subviews objectEnumerator];
id anObject;
while (anObject = [enumerator nextObject]) {
if([anObject isKindOfClass: [UIView class]])
{
((UIView*)anObject).backgroundColor = bkColor;
[self spreadBackgroundColor:anObject withColor:bkColor]; …Run Code Online (Sandbox Code Playgroud) 我不小心将Xcode场景文件编辑器中的空节点移动到我拥有世界节点的0,0坐标.
取消选择后,我意识到了这个错误.
现在我无法再选择它了.它是世界节点的孩子,我只能选择世界节点.
推送到后退菜单似乎不起作用,可能是因为节点的关系.
唯一的解决方法似乎是忽略这个空节点或删除世界节点,但我必须将每个其他节点的父节点设置为场景,否则如果移除世界,我的所有子节点都将被删除.
似乎很愚蠢,Xcode没有办法删除另一个节点或树视图下面的节点,就像xib编辑器一样......

我知道在stackoverflow上有很多类似的问题,但我的有点不同.我会用图像来展示它,因为它更容易理解.使用这个代码,我从 这里得到了这个结果:

很容易看到屏幕上没有第二个按钮.我尝试了但UIToolbar帧中的负数,但它们不起作用.我不需要任何标题,只能将这些按钮移到左侧.
iphone cocoa-touch objective-c uinavigationbar uibarbuttonitem
cocoa-touch ×5
objective-c ×5
icloud ×2
cocoa ×1
csv ×1
iphone ×1
plist ×1
sprite-kit ×1
uitableview ×1
uti ×1
xcode ×1