dhohmann
Mitglied
Thread Starter
- Dabei seit
- 27.07.2008
- Beiträge
- 56
- Reaktionspunkte
- 1
Hallo zusammen,
ich bin ziemlich neu bei der Entwicklung von iPhone-Applikationen, versuche mich aber derzeit an einer kleinen Medizin-App.
Die App besteht aus einem Tab Bar Controller; im ersten Item befindet sich ein Navigation Controller und ein UITableView (Grouped). Das Problem ist, dass beim Scrollen der Tabelle auf dem iPhone dieser Vorgang ruckelt und nicht so schön "smooth" abläuft wie in der Einstellungen-App. Im Simulator ist alles normal. Mein Array hat nur 15 Werte, sodass auch nicht zuviel Daten das Problem verursachen sollten.
Leider konnte auch in der Apple-Dokumentation und per Google keine Lösung finden.
Über sämtliche Tipps würde ich mich sehr freuen.
Vielen Dank!
ich bin ziemlich neu bei der Entwicklung von iPhone-Applikationen, versuche mich aber derzeit an einer kleinen Medizin-App.
Die App besteht aus einem Tab Bar Controller; im ersten Item befindet sich ein Navigation Controller und ein UITableView (Grouped). Das Problem ist, dass beim Scrollen der Tabelle auf dem iPhone dieser Vorgang ruckelt und nicht so schön "smooth" abläuft wie in der Einstellungen-App. Im Simulator ist alles normal. Mein Array hat nur 15 Werte, sodass auch nicht zuviel Daten das Problem verursachen sollten.
Leider konnte auch in der Apple-Dokumentation und per Google keine Lösung finden.
Über sämtliche Tipps würde ich mich sehr freuen.
Vielen Dank!
Code:
//
// UnfallTableViewController.h
#import <UIKit/UIKit.h>
@class UnfallDetailViewController;
@interface UnfallTableViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> {
UITableView *unfallTableView;
NSMutableArray *notfallArray;
NSMutableArray *weitereArray;
UnfallDetailViewController *unfallDetailViewController;
}
@property (nonatomic, retain) NSMutableArray *notfallArray;
@property (nonatomic, retain) NSMutableArray *weitereArray;
@property (nonatomic, retain) UnfallDetailViewController *unfallDetailViewController;
@end
Code:
//
// UnfallTableViewController.m
#import "UnfallTableViewController.h"
#import "UnfallDetailViewController.h"
#import "HomAid_004AppDelegate.h"
@implementation UnfallTableViewController
@synthesize notfallArray;
@synthesize weitereArray;
@synthesize unfallDetailViewController;
- (void)viewDidLoad {
[super viewDidLoad];
self.title = NSLocalizedString(@"Unfall", @"Unfall Titel");
NSMutableArray *array1 = [[NSMutableArray alloc]
initWithObjects:
@"Haus", @"Freizeit", @"Verkehr", nil];
NSMutableArray *array2 = [[NSMutableArray alloc]
initWithObjects:
@"Eins", @"Zwei", @"Drei",
@"Vier", @"Fünf", @"Sechs",
@"Sieben", @"Acht", @"Neun",
@"Zehn", @"Elf", @"Zwölf", nil];
self.notfallArray = array1;
self.weitereArray = array2;
[notfallArray release];
[weitereArray release];
UIBarButtonItem *info = [[UIBarButtonItem alloc]
initWithTitle:@"Notruf"
style:UIBarButtonItemStyleBordered
target:self action:@selector(sosCall:)];
self.navigationItem.rightBarButtonItem = info;
}
- (void)sosCall:(id)sender {
NSLog(@"Notruf Button gedrückt");
UIApplication *app = [UIApplication sharedApplication];
NSString *urlString = [NSString stringWithFormat:@"tel:123456789"];
NSURL *url = [NSURL URLWithString:urlString];
[app openURL:url];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
self.notfallArray = nil;
self.weitereArray = nil;
self.unfallDetailViewController = nil;
}
#pragma mark Table view methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if(section == 0)
return [notfallArray count];
else
return [weitereArray count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *UnfallTableIdentifier = @"UnfallTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:UnfallTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:UnfallTableIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
if(indexPath.section == 0)
cell.textLabel.text = [notfallArray objectAtIndex:row];
else
cell.textLabel.text = [weitereArray objectAtIndex:row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
if (self.unfallDetailViewController == nil) {
UnfallDetailViewController *unfallDetail = [[[UnfallDetailViewController alloc]
initWithNibName:@"UnfallDetailView"
bundle:nil] autorelease];
self.unfallDetailViewController = unfallDetail;
}
if(indexPath.section == 0)
unfallDetailViewController.title = [NSString stringWithFormat:@"%@", [notfallArray objectAtIndex:row]];
else
unfallDetailViewController.title = [NSString stringWithFormat:@"%@", [weitereArray objectAtIndex:row]];
[self.navigationController pushViewController:unfallDetailViewController animated:YES];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if (section == 0)
return @"Notfall";
else
return @"weitere Unfälle";
}
- (void)dealloc {
[unfallTableView release];
[notfallArray release];
[weitereArray release];
[unfallDetailViewController release];
[super dealloc];
}
@end