When I run my app and press the button that takes me to the page Jaw, a blank black screen is displayed instead. I don't get any kind of run error or anything in my log. When I added an NSLog to the ViewDidLoad to check if the method is evoked, nothing is displayed in my log! Does anyone know what is causing this?
This is the code of the page "Jaw",
.h:
.m
This is the code of the page "Jaw",
.h:
Code:
#import <UIKit/UIKit.h>
#import <sqlite3.h>
#import "ViewController.h"
#import "NewCase.h"
#import "Info.h"
#import "Needed.h"
#import "Available.h"
#import "import.h"
#import "Result.h"
#import "Ps.h"
#import "Patiant.h"
@interface Jaws : UIViewController <UINavigationControllerDelegate>
{
sqlite3 *database;
NSString *file;
}
@property (retain, nonatomic) NSString *file;
@property (strong, nonatomic) IBOutlet UIView *view;
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UILabel *UpperT;
@property (weak, nonatomic) IBOutlet UIImageView *Upper;
@property (weak, nonatomic) IBOutlet UILabel *LowerT;
@property (weak, nonatomic) IBOutlet UIImageView *Lower;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *Back;
- (IBAction)Back:(id)sender;
-(void)retrieve;
@end
Code:
#import "Jaws.h"
@interface Jaws ()
@end
@implementation Jaws
@synthesize Upper, Lower, file, scrollView, Back, UpperT, LowerT, view;
NewCase *new;
-(BOOL) respondsToSelector:(SEL)aSelector {
printf("SELECTOR: %s\n", [NSStringFromSelector(aSelector) UTF8String]);
return [super respondsToSelector:aSelector];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self retrieve];
[scrollView setContentSize:CGSizeMake(340, 1000)];
// Do any additional setup after loading the view from its nib.
}
- (void)viewDidUnload
{
[self setScrollView:nil];
[self setBack:nil];
[self setUpper:nil];
[self setLower:nil];
[self setUpperT:nil];
[self setLowerT:nil];
[self setView:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(void)retrieve
{
int type;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"TTSData.sql"];
if (sqlite3_open([path UTF8String], &database) == SQLITE_OK)
{
NSString *presql = [ NSString stringWithFormat:@"SELECT * FROM Jaw WHERE file = '%d' ", [file intValue]];
const char *sql = [presql UTF8String];
sqlite3_stmt *searchStatement;
if (sqlite3_prepare_v2(database, sql, -1, &searchStatement, NULL) == SQLITE_OK)
{
while (sqlite3_step(searchStatement) == SQLITE_ROW)
{
UIImage *jaw = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithUTF8String:(char *)sqlite3_column_text(searchStatement, 0)]];
type = sqlite3_column_int(searchStatement, 2);
Upper.image= jaw;
if ([new.JType isEqualToString:@"0"])
{
LowerT.text = @"NO Lower Jaw";
}
else if ([new.JType isEqualToString:@"1"])
{
UpperT.text = @"Lower Jaw";
LowerT.text = @"NO Upper Jaw";
}
else
{
Upper.image= jaw;
Lower.image= jaw;
}
}
}
}
}
- (IBAction)Back:(id)sender
{
Patiant *a = [[Patiant alloc] initWithNibName:nil bundle:nil];
a.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:a animated:YES];
}
@end
Last edited: