我在UIScrollView中显示PDF.为此,我使用:
myDocumentRef = CGPDFDocumentCreateWithURL((CFURLRef)[[NSBundle mainBundle] URLForResource:@"salonMap" withExtension:@"pdf"]);
Run Code Online (Sandbox Code Playgroud)
现在,我尝试使其适用于IOS 3.1(NSBundle URLForResource:3.1中不存在withExtension)
我将代码转换为:
NSString *fullPath = [[NSBundle mainBundle] pathForResource:@"salonMap" ofType:@"pdf"];
NSLog(@"%@", fullPath);
CFStringRef fullPathEscaped = CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)fullPath, NULL, NULL,kCFStringEncodingUTF8);
CFURLRef urlRef = CFURLCreateWithString(NULL, fullPathEscaped, NULL);
myDocumentRef = CGPDFDocumentCreateWithURL(urlRef);
Run Code Online (Sandbox Code Playgroud)
但它导致了一个
<Error>: CFURLCreateDataAndPropertiesFromResource: failed with error code -15
Run Code Online (Sandbox Code Playgroud)
我确切地说NSLog记录了
/var/mobile/Applications/1CF69390-85C7-45DA-8981-A279464E3249/myapp.app/salonMap.pdf"
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
我从Python程序中的Web服务检索unix时间戳.此时间戳位于美国时区.为了将其插入到MySQL数据库中与其他对象(位于法国),我想将此时间戳转换为法国时区.
我可以用数学函数来做,但是有夏令时的问题.我更喜欢使用Python时间和日期特定的功能来处理这些概念.
你有提示吗,我迷失在Python文档中?
当我接受我的申请时,我从用户那里获得了offline_access.现在,在我的网站中,用户可以删除我对他的Facebook帐户的访问权限.有没有办法,告诉Facebook从这个用户删除我的应用程序?
谢谢你的帮助
我在我的git存储库中添加了我想要删除的文件.我用它删除了它rm XXX
.现在,git status
告诉我:
Changed but not updated:
deleted: "Sche\314\201ma application + interface.graffle"
Run Code Online (Sandbox Code Playgroud)
不管我怎么样git rm
,我还有一个:
fatal: pathspec 'Schêma application + interface.graffle' did not match any files
Run Code Online (Sandbox Code Playgroud)
我试图逃跑的空格用\
,为了躲避\
同\\
,逃跑"
用\"
.无论我尝试什么,都失败了.
你有提示吗?
我的应用程序基于标签栏架构.为了拥有一个简单的国际化机制,我不在XIB文件中写任何字符串.viewdidload允许以编程方式更改视图中的字符串.
当我的应用程序启动时,我可以看到4个选项卡.但事实上只有第一个加载其视图控制器.其他人等待用户点击加载.可以使用[self setTitle:@"Mouhahaha"]更改标签标题; 在viewDidLoad中加载了视图控制器.
如果我想保持我的国际化机制,我不会在我的XIB中设置tabbar项的名称.但是,在开始时所有选项卡的视图控制器都没有加载,我有一些标签的空白标题.仅当用户单击选项卡时才设置右侧标题.
我正在寻找一种方法来为每个tabbaritem设置这个标题programaticaly.你有提示吗?
非常感谢.
kheraud
我有一个包含许多模块的包.每个模块使用我在每个文件中独立定义的常量.但是,所有这些常量必须相互一致.所以我尝试在一个文件中定义它们并将其导入每个文件中.当我运行它时,我找不到常量的常量错误.
他们是一个干净的方式让一个文件由许多其他人导入并包含常量?
谢谢你的帮助
我尝试将我的SQL查询转换为HQL或JPQL(我希望受益于对象映射).
我的SQL请求是:
SELECT *
FROM (SELECT bde, MAX(creation_date)
FROM push_campaign GROUP BY bde) temp,
push_campaign pc where pc.bde = temp.bde and pc.creation_date = temp.creation_date;
Run Code Online (Sandbox Code Playgroud)
我尝试(不成功)在JPQL中转换它:
select pc
from (select bde, max(creationDate)
from PushCampaign group by bde) temp,
PushCampaign pc
where pc.bde = temp.bde and pc.creationDate = temp.creationDate
Run Code Online (Sandbox Code Playgroud)
但我得到了提升:
Run Code Online (Sandbox Code Playgroud)IllegalArgumentException occured :
org.hibernate.hql.ast.QuerySyntaxException:意外令牌:(第1行,第16列[选择pc from(select id,max(creationDate)from models.PushCampaign group by bde)temp,models.PushCampaign pc where pc.id = temp.id]
我读的嵌套选择只能在select或where子句中.
您是否有解决方案来保持对象映射的请求和好处?
我正在寻找关于模型的最佳实践以及使用play 2.0在数据库中持久保存对象的方法.我已经使用scala研究了Play和类型安全样本for play 2.0.
我的理解是:
因此,如果我需要更新我的Car对象以定义新的所有者,我将不得不这样做:
val updatedCar = myCar.copy(owner=newOwner)
Car.update(updatedCar)
// or
Car.updateOwner(myCar.id.get, newOwner)
Run Code Online (Sandbox Code Playgroud)
我想知道为什么更新或删除语句不在case类本身:
case class Car(id: Pk[Long] = NotAssigned, owner: String) {
def updateOwner(newOwner: String) {
DB.withConnection { implicit connection =>
SQL(
"""
update car
set owner = {newOwner}
where id = {id}
"""
).on(
'id -> id,
'newOwner -> newOwner
).executeUpdate()
}
copy(owner = newOwner)
}
}
Run Code Online (Sandbox Code Playgroud)
这样做可以做到:
val updatedCar = myCar.updateOwner(newOwner)
Run Code Online (Sandbox Code Playgroud)
这就是我以前使用Java和JPA对Play 1.X所做的.也许原因很明显,并且由于我对Scala的了解不多.
我的日志被提取,管道并合并到elasticsearch中.多线事件很难跟踪和诊断.
而不是使用收集器和正则表达式来组合单个记录中的异常行,是否有一种方法可以使用logback配置将Exception
堆栈跟踪放在一行上?
我在周末期间未能解决这个问题...我认为对Objective-C内存管理有很好的了解,但是这个很难解决.
总结一下上下文:我有一个吸引人的UIViewController,我在我的navigationcontroller中推送.这个UIViewController包含一个UIScrollView(在IB中创建).在UIViewController viewDidLoad()函数中,我添加了一个背景PDF(在UIview层的CATiledLayer子层中).
问题是,当我从导航控制器弹出UIViewController时,应用程序崩溃了.
使用Zombies工具和NSZombieLevel表明这是因为UIViewController被过度释放.
这是UIViewController:
@interface PlanViewController : UIViewController <UIScrollViewDelegate> {
UIScrollView *panelScrollView;
UIView *myContentView;
CGPDFDocumentRef myDocumentRef;
CGPDFPageRef myPageRef;
}
@property (nonatomic, retain) IBOutlet UIScrollView *panelScrollView;
@property (nonatomic, retain) UIView *myContentView;
@end
@implementation PlanViewController
@synthesize panelScrollView;
@synthesize myContentView;
- (void)viewDidLoad {
[self setTitle:@"Plan"];
myDocumentRef = CGPDFDocumentCreateWithURL((CFURLRef)[[NSBundle mainBundle] URLForResource:@"salonMap" withExtension:@"pdf"]);
myPageRef = CGPDFDocumentGetPage(myDocumentRef, 1);
CGRect pageRect = CGRectIntegral(CGPDFPageGetBoxRect(myPageRef, kCGPDFCropBox));
CATiledLayer *tiledLayer = [[CATiledLayer alloc] init];
[tiledLayer setDelegate:self];
[tiledLayer setTileSize:CGSizeMake(1024.0, 1024.0)];
[tiledLayer setLevelsOfDetail:4];
[tiledLayer setLevelsOfDetailBias:8];
[tiledLayer setFrame:pageRect]; …
Run Code Online (Sandbox Code Playgroud) iphone cocoa-touch memory-management release-management uinavigationcontroller
ios ×2
iphone ×2
python ×2
cfstring ×1
cocoa-touch ×1
date ×1
datetime ×1
encoding ×1
facebook ×1
git ×1
git-rm ×1
hql ×1
import ×1
java ×1
jpql ×1
logback ×1
logging ×1
model ×1
nhibernate ×1
nsbundle ×1
nsurl ×1
package ×1
scala ×1
slf4j ×1
sql ×1
timezone ×1
uitabbar ×1
uitabbaritem ×1
viewdidload ×1