我想问一下,如果我在创建greenDao数据库时有可能添加默认值?
Example:
Property pictureIdProperty = user.addLongProperty("pictureId").getProperty();
Property thumbnailIdProperty = user.addLongProperty("thumbnailId").getProperty();
//and here I need something like this:
//thumbnailIdProperty.setDefault(-1); //there is possible to add
user.addToOne(picture, pictureIdProperty);
user.addToOne(picture, thumbnailIdProperty, "thumbnail");
Run Code Online (Sandbox Code Playgroud)
当我使用数据库和这个表时,我不需要在创建此模型时始终添加默认值.
我正在使用 ios 7,我需要做:
在单独的线程中,我想从网络创建图像并将其放入 UIImageView。我需要每 200 毫秒执行一次。
我的代码看起来像:
- (void)startPreview:(CGFloat)specialFramesRates;
{
if(isPreview)
return;
[Utils runOnThread:^{
[Log log:@"Start preview"]; //here we have a leak
isPreview = YES;
while(isPreview) {
[self getNewBitmap];
sleep(fpsTime);
if(!isPreview)
break;
if(checkAvabilityCam > 10)
break;
}
[Log log:@"Stoped preview"];
}];
}
- (void)getNewBitmap
{
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
[request setTimeoutInterval:1];
[request setHTTPMethod:@"GET"];
NSError *requestError;
NSURLResponse *urlResponse = nil;
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&requestError];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
if(delegate && response) {
checkAvabilityCam = 0; …
Run Code Online (Sandbox Code Playgroud)