Hi guys,
Im really glad to say that my application framework and design is coming an end and the SQL data entries are beginning!..
I have some questions regarding best practises and application performance.
1] My application takes some time after getting tapped to show up.. I think theres a second of black view and then the tabbar app appears. The testing is being done in iPod device
I dont really call much in AppDidfinishLaunching except
The initialiseDatabaseCondition grabs stuff from the SQLite db in a very exactly the same way as the example - SQLiteBooks. Any comments here.. to speeed up the process of loading would be great.
I've seen some apps like (SQLiteBooks) that start with animation.. kinda,, like on tapping, the view appears with animation. In my case, the black view animates and shows up and then the tabbar view is added to it. How can i rectify/change this design flaw!??
They've got a default.png...
2]All arrays are in the AppDelegate. And I'm using them from all other controllers. Almost every controller's methods have this linkage. All tableView methods, pickerViews.. etc..
Should I localise the arrays to specific controllers if applicable/possible?
3] I have a method, where I initialise the Database everytime depending on what the user chooses.. Like initialiseDatabaseWith@"Select ID from table WHERE site=";
I kinda use NSString stringwithFormat method to attach the site=? to the string and call initialiseDatabase.. Since I'm calling it evertime the user chooses, As earliar you've seen in the code, I clearedAllObjects from that specific NSMutableArray.
There isnt much memory handling here, since i know little about it..
Is there a better way to save up memory and reload an array.. etc??
4]SQL caching..? i dont know anything about it.. and direction is appreciated.
5]I have about 4 tableviews, One requires checkmarks like -TouchCells, the other requires a subtext below the main text, another needs a disclosure indicator, etc..
Due to my incredible laziness, i added booleans to my CustomCell and made a single Class to handle all 4 tableViews.
This is an example of one! tableView... the other may say NO to those booleans
6]Sometimes I feel im depending too much on my AppDelegate.. is it any real concern? But There had to be a common link between them!.. atleast for 2 mutablearrays that check and compare each other..
and, if u still have some time for me
,
HOW TOs: In my pickerView, i changed the Views. made its inside look great. with different fonts and different background colors..
But theres one problem, The PickerView Color inside remains white. its only "pickerItems" change the background view to orange..or something
THis is apparent on scroll.. when the data finishes, the white color appears.. So i concluded that since im slapping my view over it as pickerItems, thats happening,
How can I change the Background white color of the pickerview entirely!.. IVE SEEN some apps that way
Im really glad to say that my application framework and design is coming an end and the SQL data entries are beginning!..
I have some questions regarding best practises and application performance.
1] My application takes some time after getting tapped to show up.. I think theres a second of black view and then the tabbar app appears. The testing is being done in iPod device
I dont really call much in AppDidfinishLaunching except
Code:
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;
[window addSubview:tabBarController.view];
//All arrays are synthesized.. and dealloc-ed
SList = [[NSMutableArray alloc] init];
sMap = [[NSMutableArray alloc] init];
SMList = [[NSMutableArray alloc] init];
ConditionsList = [[NSMutableArray alloc] init];
c1=[[NSArray alloc] initWithObjects:@"item0", @"item1", @"item2",nil];
//2 more similar NSArrays but with more NString data.
[window addSubview:tabBarController.view];
[self initialiseDatabaseCondition:@"SELECT ID FROM sList"];
-(void)initialiseDatabaseCondition:(NSString *)sqline{
[ConditionsList removeAllObjects]; //This initialisation is executed multiple times.. so I clear the List everytime its called.
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"DB.sqlite"];
if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {
const char *sqln = [sqline UTF8String];
sqlite3_stmt *statement;
if (sqlite3_prepare_v2(database, sqln, -1, &statement, NULL) == SQLITE_OK) {
while (sqlite3_step(statement) == SQLITE_ROW) {
int pk = sqlite3_column_int(statement, 0);
ConditionClass *nCon = [[ConditionClass alloc] initWithPrimaryKey:pk database:database];
[ConditionsList addObject:nCon];
[nCon release];
}
}
sqlite3_finalize(statement);
}else{
sqlite3_close(database);
NSAssert1(0, @"Failed to open database with message '%s'.", sqlite3_errmsg(database));
//[self say:@"failed"];
}
}
The initialiseDatabaseCondition grabs stuff from the SQLite db in a very exactly the same way as the example - SQLiteBooks. Any comments here.. to speeed up the process of loading would be great.
I've seen some apps like (SQLiteBooks) that start with animation.. kinda,, like on tapping, the view appears with animation. In my case, the black view animates and shows up and then the tabbar view is added to it. How can i rectify/change this design flaw!??
They've got a default.png...
2]All arrays are in the AppDelegate. And I'm using them from all other controllers. Almost every controller's methods have this linkage. All tableView methods, pickerViews.. etc..
Code:
SDAppDelegate *appDel = (SDAppDelegate *)[[UIApplication sharedApplication]delegate];
3] I have a method, where I initialise the Database everytime depending on what the user chooses.. Like initialiseDatabaseWith@"Select ID from table WHERE site=";
I kinda use NSString stringwithFormat method to attach the site=? to the string and call initialiseDatabase.. Since I'm calling it evertime the user chooses, As earliar you've seen in the code, I clearedAllObjects from that specific NSMutableArray.
There isnt much memory handling here, since i know little about it..
Is there a better way to save up memory and reload an array.. etc??
4]SQL caching..? i dont know anything about it.. and direction is appreciated.
5]I have about 4 tableviews, One requires checkmarks like -TouchCells, the other requires a subtext below the main text, another needs a disclosure indicator, etc..
Due to my incredible laziness, i added booleans to my CustomCell and made a single Class to handle all 4 tableViews.
Code:
static NSString *kCustomCellID = @"MyCellID";
CustomCell *cell = (CustomCell *)[self.tableView dequeueReusableCellWithIdentifier:kCustomCellID];
if (cell == nil)
{
cell = (CustomCell *)[[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:kCustomCellID] autorelease];
}
cell.moreIndicatorNeeded = YES; //its the disclosureIndicator
cell.subtxtNeeded = YES;
SDAppDelegate *appDelegate = (SDAppDelegate *)[[UIApplication sharedApplication] delegate];
ConditionClass *nCon = (ConditionClass *)[appDelegate.ConditionsList objectAtIndex:indexPath.row];
cell.title = nCon.txtCondition;
cell.subtxt = [appDelegate.pp objectAtIndex:nCon.System];
return cell;
This is an example of one! tableView... the other may say NO to those booleans
6]Sometimes I feel im depending too much on my AppDelegate.. is it any real concern? But There had to be a common link between them!.. atleast for 2 mutablearrays that check and compare each other..
and, if u still have some time for me
HOW TOs: In my pickerView, i changed the Views. made its inside look great. with different fonts and different background colors..
But theres one problem, The PickerView Color inside remains white. its only "pickerItems" change the background view to orange..or something
THis is apparent on scroll.. when the data finishes, the white color appears.. So i concluded that since im slapping my view over it as pickerItems, thats happening,
How can I change the Background white color of the pickerview entirely!.. IVE SEEN some apps that way