this is my code that shows data in table,my complete data is not showing in cell. 1st image is when i set scrollable to no ,2nd image when i do not set scrollable.i am a beginner.plz help me out of this.
- (void)textViewDidChange:(UITextView *)textView{
[table beginUpdates];
[table endUpdates];
}
-(void)createdatabase{
BOOL success;
NSFileManager *filemanager = [NSFileManager defaultManager];
success = [filemanager fileExistsAtPath:datapath];
if (success)return;
NSString *databasefromapp = [[[NSBundle mainBundle] resourcePath]stringByAppendingPathComponent:dataname];
[filemanager copyItemAtPath:databasefromapp toPath:datapath error:nil];
}
-(void)getdatabase{
eventitleary = [[NSMutableArray alloc]init];
eventdescary = [[NSMutableArray alloc]init];
eventimgary = [[NSMutableArray alloc] init];
sqlite3 *dataname1;
if (sqlite3_open([datapath UTF8String],&dataname1) == SQLITE_OK) {
const char *sqlStatement;
sqlStatement = "SELECT * FROM photography_events";
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(dataname1, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)
{
// Loop through the results and add them to the feeds array
while(sqlite3_step(compiledStatement) == SQLITE_ROW)
{
// Read the data from the result row
NSString *str_title = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
[eventitleary addObject:str_title];
NSString *str_desc = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];
[eventdescary addObject:str_desc];
NSData *data = [[NSData alloc] initWithBytes:sqlite3_column_blob(compiledStatement, 2) length:sqlite3_column_bytes(compiledStatement, 2)];
[eventimgary addObject:data];
}
}
}
NSLog(@"%@", eventitleary);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return eventitleary.count;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *cellidenti = @"CellIdenti";
TableViewCell2 *cell = (TableViewCell2*)[tableView dequeueReusableCellWithIdentifier:cellidenti];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"TableViewCell2" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.eventitlelbl.text = [eventitleary objectAtIndex:indexPath.row];
cell.eventdesc.text = [eventdescary objectAtIndex:indexPath.row];
cell.eventdesc.editable = NO;
//cell.eventdesc.scrollEnabled = NO;
[cell.eventdesc sizeToFit];
frame = cell.eventdesc.frame;
frame.size = cell.eventdesc.contentSize;
cell.eventdesc.frame = frame;
NSData *dataimg = (NSData*)[eventimgary objectAtIndex:indexPath.row];
cell.eventimg.image = [UIImage imageWithData:dataimg];
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
// Return the height with a bit of additional padding space
return frame.size.height + 300;
}