我有一个应用程序,要求用户提供信息,然后签名。单击“符号”按钮后,它们将被带到名为“myviewcontroller”的视图控制器。
从那里我想要显示的是以下屏幕,但是每当我点击“签名”按钮时,签名捕获将占据整个屏幕,当它工作时,我无法看到他们应该签名的“x”。
我不知道我错过了什么,或者我错误地称之为导致这种情况发生的原因。
#import "MyViewController.h"
@interface MyViewController ()
@end
@implementation MyViewController
@synthesize mySignatureImage;
@synthesize lastContactPoint1, lastContactPoint2, currentPoint;
@synthesize imageFrame;
@synthesize fingerMoved;
@synthesize navbarHeight;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
//set the title of the navigation view
[self.navigationItem setTitle:@"Sign here"];
//create a save button in the navigation bar
UIBarButtonItem *myButton = [[UIBarButtonItem alloc]
initWithTitle:@"Save"
style:UIBarButtonItemStylePlain
target:self
action:@selector(saveSignature:)];
[self.navigationItem setRightBarButtonItem:myButton];
//set the view background to light gray
self.view.backgroundColor = [UIColor lightGrayColor];
//get reference to the navigation frame to calculate navigation bar height
CGRect navigationframe = [[self.navigationController navigationBar] frame];
navbarHeight = navigationframe.size.height;
//create a frame for our signature capture based on whats remaining
imageFrame = CGRectMake(self.view.frame.origin.x+10,
self.view.frame.origin.y-5,
self.view.frame.size.width-20,
self.view.frame.size.height-navbarHeight-30);
//allocate an image view and add to the main view
mySignatureImage = [[UIImageView alloc] initWithImage:nil];
mySignatureImage.frame = imageFrame;
mySignatureImage.backgroundColor = [UIColor whiteColor];
[self.view addSubview:mySignatureImage];
}
实际签名捕获的代码更多,但这是与视图控制器直接相关的内容。
http://i59.tinypic.com/f06ph2.jpg http://i61.tinypic.com/29cqy8.jpg