Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-07-2011, 03:23 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 1
pmunz is on a distinguished road
Default TableViewCell / tableView - ZXing

hello,

Please Help me, i coding in the Zxing app ( Iphone Barcode Example )
help me to edit the TableView, sorry my English , i am from Austria

Edit TableView : width height ? and add an backgrund.png

The ArchiveController.m
Code:
#import "ArchiveController.h"
#import "Database.h"
#import "Scan.h"
#import "UniversalResultParser.h"
#import "ParsedResult.h"
#import "ScanViewController.h"
#import "ScanCell.h"



@implementation ArchiveController

@synthesize scans;
@synthesize results;
@synthesize delegate;
@synthesize dateFormatter;

- (id) initWithFrame:(CGRect)frm {
    if ((self = [super initWithStyle: UITableViewStylePlain])){
        
        
    }
    return self;
}



- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
	return 1;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
	return [scans count];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  return 44.0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	static NSString *ScanIdentifier = @"ScanIdentifier";
	ScanCell *cell = (ScanCell *)[tableView dequeueReusableCellWithIdentifier:ScanIdentifier];
	if (cell == nil) {
		cell = [[[ScanCell alloc] initWithFrame:CGRectZero reuseIdentifier:ScanIdentifier] autorelease];
	}
  
	// Configure the cell
  int idx = [self scanIndexForRow:indexPath.row];
  Scan *scan = [scans objectAtIndex:idx];
  [cell setScan:scan];
    
  
    
	return cell;
}







- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    

    
  //[decoderViewController showScan:[scans objectAtIndex:[self scanIndexForRow:indexPath.row]]];
  int idx = [self scanIndexForRow:indexPath.row];
    
  Scan *scan = [scans objectAtIndex:idx];
  ParsedResult *result = [results objectAtIndex:idx];
  ScanViewController *scanViewController = [[ScanViewController alloc] initWithResult:result forScan:scan];
  [self.navigationController pushViewController:scanViewController animated:YES];
  [scanViewController release];
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
	if (editingStyle == UITableViewCellEditingStyleDelete) {
    int idx = [self scanIndexForRow:indexPath.row];
    Scan *scan = [self.scans objectAtIndex:idx];
    // delete the scan from the database ...
    [[Database sharedDatabase] deleteScan:scan];
    // ... delete the scan from our in-memory cache of the database ...
    [scans removeObjectAtIndex:idx];
    // ... delete the corresponding result from our in-memory cache  ...
    [results removeObjectAtIndex:idx];
    // ... and remove the row from the table view.
    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    // [tableView reloadData];
	} else if (editingStyle == UITableViewCellEditingStyleInsert) {
    // no insertions!
	}
}

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
	return YES;
}

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
	return NO;
}


- (void)dealloc {
  [scans release];
  [results release];
  delegate = nil;
  [dateFormatter release];
	[super dealloc];
}


- (void)viewDidLoad {

    
	[super viewDidLoad];
    
   
    
        
  NSMutableArray *theScans = [[NSMutableArray alloc] init];
  self.scans = theScans;
  [theScans release];
  
  NSMutableArray *theResults = [[NSMutableArray alloc] init];
  self.results = theResults;
  [theResults release];
  
  NSDateFormatter *theDateFormatter = [[NSDateFormatter alloc] init];
  self.dateFormatter = theDateFormatter;
  [theDateFormatter release];
  
  self.title = NSLocalizedString(@"ScanArchiveTitle", @"Scan Archive");
  self.navigationItem.rightBarButtonItem = [self editButtonItem];
    
    //// pm Private Start
    
   // [[UITableView alloc] initWithFrame:CGRectMake(0, 102.5, 320, 160) style:UITableViewStylePlain];
    //self.tableView.frame = CGRectMake(45.0,10.0,10,10);

    self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    self.tableView.rowHeight = 100;
    
    self.tableView.backgroundColor = [UIColor clearColor];
    self.tableView.separatorColor = [UIColor grayColor];
    self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Leerbackgroundimage.png"]];
    
        
    //// pm Private End
  
  self.scans = [NSMutableArray arrayWithArray:[[Database sharedDatabase] scans]];
  self.results = [NSMutableArray arrayWithCapacity:self.scans.count];
  for (Scan *scan in scans) {
    ParsedResult *res = [UniversalResultParser parsedResultForString:scan.text];
    [results addObject:res];
  }
}

-(void)done:(id)sender {
  [delegate modalViewControllerWantsToBeDismissed:self];
}





- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
    ////
    
        
    



    ////
    
    
  self.scans = [NSMutableArray arrayWithArray:[[Database sharedDatabase] scans]];
  self.results = [NSMutableArray arrayWithCapacity:self.scans.count];
  for (Scan *scan in scans) {
    [results addObject:[UniversalResultParser parsedResultForString:scan.text]];
  }
  [self.tableView reloadData];
}

- (void)viewDidAppear:(BOOL)animated {
	[super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
  self.scans = nil;
  self.results = nil;
}

- (void)viewDidDisappear:(BOOL)animated {
}

- (void)didReceiveMemoryWarning {
	[super didReceiveMemoryWarning];
}

- (NSInteger)scanIndexForRow:(NSInteger)row {
  return scans.count - 1 - row;
}

@end


very thanks for help me!
pmunz is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, sdk, xcode, zxing

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 401
18 members and 383 guests
13dario13, 7twenty7, eski, EvilElf, glenn_sayers, HemiMG, iOS.Lover, jarv, LunarMoon, n00b, pbart, Pudding, QuantumDoja, sacha1996, Sami Gh, UMAD, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:21 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0