当前位置: 编程技术>移动开发
本页文章导读:
▪放大镜成效(二) 放大镜效果(二)
以前也写过一篇:放大镜效果,现在,提供另一种。
MagnifierView.h
@interface MagnifierView : UIWindow {
UIView *viewToMagnify;
CGPoint touchPoint;
}
@property (nonatomic, retain) UIView *viewToMagn.........
▪ sde异常 sde错误
在catalog中导入shpfile或者gdb到sde的时候,如果输出目录提示错误00037信息sde不存在,则需要手动调整输出目录到指定的sde上
......
▪ hibernate 发生object references an unsaved transient instance错误 hibernate 发生object references an unsaved transient instance异常
object references an unsaved transient instance - save the transient instance before flushing: user.pojo.HotelGoodsCatalog; nested exception is org.hibernate.TransientObjectExce.........
[1]放大镜成效(二)
来源: 互联网 发布时间: 2014-02-18
放大镜效果(二)
以前也写过一篇:放大镜效果,现在,提供另一种。
MagnifierView.h
@interface MagnifierView : UIWindow { UIView *viewToMagnify; CGPoint touchPoint; } @property (nonatomic, retain) UIView *viewToMagnify; @property (assign) CGPoint touchPoint; @end
MagnifierView.m
#import "MagnifierView.h" #import <QuartzCore/QuartzCore.h> @implementation MagnifierView @synthesize viewToMagnify, touchPoint; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:CGRectMake(0, 0, 80, 80)]) { self.layer.borderColor = [[UIColor lightGrayColor] CGColor]; self.layer.borderWidth = 3; self.layer.cornerRadius = 40; self.layer.masksToBounds = YES; self.windowLevel = UIWindowLevelAlert; } return self; } - (void)setTouchPoint:(CGPoint)pt { touchPoint = pt; self.center = CGPointMake(pt.x, pt.y-10); } - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, self.frame.size.width * 0.5, self.frame.size.height * 0.5); CGContextScaleCTM(context, 1.5, 1.5); CGContextTranslateCTM(context, -1 * (touchPoint.x), -1 * (touchPoint.y)); [self.viewToMagnify.layer renderInContext:context]; } - (void)dealloc { [viewToMagnify release]; [super dealloc]; } @end
TouchReader.h
#import <UIKit/UIKit.h> #import "MagnifierView.h" @interface TouchReader : UIView { NSTimer *touchTimer; MagnifierView *loop; } @property (nonatomic, retain) NSTimer *touchTimer; - (void)addLoop; - (void)handleAction:(id)timerObj; @end
TouchReader.m
#import "TouchReader.h" #import "MagnifierView.h" @implementation TouchReader @synthesize touchTimer; - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { self.clipsToBounds = NO; self.touchTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(addLoop) userInfo:nil repeats:NO]; if(loop == nil){ loop = [[MagnifierView alloc] init]; loop.viewToMagnify = self; } UITouch *touch = [touches anyObject]; loop.touchPoint = [touch locationInView:self]; [loop setNeedsDisplay]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [self handleAction:touches]; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [self.touchTimer invalidate]; self.touchTimer = nil; [loop release]; loop = nil; } - (void)addLoop { [loop makeKeyAndVisible]; } - (void)handleAction:(id)timerObj { NSSet *touches = timerObj; UITouch *touch = [touches anyObject]; loop.touchPoint = [touch locationInView:self]; [loop setNeedsDisplay]; } - (void)dealloc { [loop release]; loop = nil; [super dealloc]; } @end
[2] sde异常
来源: 互联网 发布时间: 2014-02-18
sde错误
在catalog中导入shpfile或者gdb到sde的时候,如果输出目录提示错误00037信息sde不存在,则需要手动调整输出目录到指定的sde上
在catalog中导入shpfile或者gdb到sde的时候,如果输出目录提示错误00037信息sde不存在,则需要手动调整输出目录到指定的sde上
[3] hibernate 发生object references an unsaved transient instance错误
来源: 互联网 发布时间: 2014-02-18
hibernate 发生object references an unsaved transient instance异常
object references an unsaved transient instance - save the transient instance before flushing: user.pojo.HotelGoodsCatalog; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: user.pojo.HotelGoodsCatalog
今天遇到修改对象的时候,hibernate报有关联的对象没有保存,其原因为hibernate在更新一个对象的时候,会去检查它所有关联的对象在数据库中是否存在,如果不存在就会报先让你保存这个对象,然后再保存此对象。也可以将cascade="none" 设为其它,如save-update等等,但是这种方法最好不要用(以上只是我个人的理解)
补充:
另外一种情况也会发生此错误,即:当你保存一个对象时User,User关联一个Card对象,而Card对象是增加了乐观锁,如果新建了一个Card对象放进User中,而Card中乐观锁的属性为null的话,这时你需要将其属性设定一个值,最好从数据库中取出
object references an unsaved transient instance - save the transient instance before flushing: user.pojo.HotelGoodsCatalog; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: user.pojo.HotelGoodsCatalog
今天遇到修改对象的时候,hibernate报有关联的对象没有保存,其原因为hibernate在更新一个对象的时候,会去检查它所有关联的对象在数据库中是否存在,如果不存在就会报先让你保存这个对象,然后再保存此对象。也可以将cascade="none" 设为其它,如save-update等等,但是这种方法最好不要用(以上只是我个人的理解)
补充:
另外一种情况也会发生此错误,即:当你保存一个对象时User,User关联一个Card对象,而Card对象是增加了乐观锁,如果新建了一个Card对象放进User中,而Card中乐观锁的属性为null的话,这时你需要将其属性设定一个值,最好从数据库中取出
最新技术文章: