- Registriert
- 21.06.13
- Beiträge
- 29
Hallo liebe Community,
ich bins mal wieder mit nem Problem, sitze schon drei tage dran und hab mich durch zig Tutorials gewühlt und das Problem nicht gefunden.
Also vorweg habe die Delegate der Tabelle per NSLOG Ausgegeben und diese ist nicht null, allerdings kommen meine Touchs nicht durch. Bedeutet die didSelectRowAtIndexPath wird nicht aufgerufen.
hier die Header:
hier das m File
vielleicht wisst ihr noch einen Rat, den ich finde den Fehler nicht.
Ich bedanke mich schon mal bei denen die den Post hier Lesen und eventuell eine Antwort darauf wissen.
Mit freundlichen Grüssen
BluyMul
Projekt:
Anhang anzeigen Apfeltalk.zip
Als zip hinterlegt
ich bins mal wieder mit nem Problem, sitze schon drei tage dran und hab mich durch zig Tutorials gewühlt und das Problem nicht gefunden.
Also vorweg habe die Delegate der Tabelle per NSLOG Ausgegeben und diese ist nicht null, allerdings kommen meine Touchs nicht durch. Bedeutet die didSelectRowAtIndexPath wird nicht aufgerufen.
hier die Header:
Code:
[COLOR=#BB2CA2]@interface[/COLOR][COLOR=#000000] Table : [/COLOR][COLOR=#703DAA]UIViewController[/COLOR][COLOR=#000000] <[/COLOR][COLOR=#703DAA]UITableViewDelegate[/COLOR][COLOR=#000000], [/COLOR][COLOR=#703DAA]UITableViewDataSource[/COLOR][COLOR=#000000]> {[/COLOR][COLOR=#008400]//[/COLOR]
[COLOR=#703daa]UITableView[/COLOR] *owntableView;
[COLOR=#703daa]UIView[/COLOR] *headView;
[COLOR=#703daa]UILabel[/COLOR] *headLabel;
}
[COLOR=#BB2CA2]@property[COLOR=#000000] ([/COLOR]nonatomic[COLOR=#000000],[/COLOR]strong[COLOR=#000000]) [/COLOR][COLOR=#703daa]UITableView[/COLOR][COLOR=#000000] *owntableView;[/COLOR][/COLOR]
[COLOR=#bb2ca2]@property[/COLOR] ([COLOR=#bb2ca2]nonatomic[/COLOR],[COLOR=#bb2ca2]strong[/COLOR]) [COLOR=#703daa]UIView[/COLOR] *headView;
[COLOR=#bb2ca2]@property[/COLOR] ([COLOR=#bb2ca2]nonatomic[/COLOR],[COLOR=#bb2ca2]strong[/COLOR]) [COLOR=#703daa]UILabel[/COLOR] *headLabel;
-([COLOR=#bb2ca2]void[/COLOR])refreshTable;
[COLOR=#BB2CA2]@end[/COLOR]
Code:
[COLOR=#78492A]#import [/COLOR][COLOR=#D12F1B]"Table.h"[/COLOR][COLOR=#D12F1B][COLOR=#78492a]#import [/COLOR]"AppDelegate.h"[/COLOR]
[COLOR=#D12F1B][COLOR=#78492a]#import [/COLOR]"defines.h"[/COLOR]
[COLOR=#BB2CA2]@interface[COLOR=#4f8187]Table[/COLOR][COLOR=#000000] ()[/COLOR][/COLOR]
[COLOR=#BB2CA2]@end[/COLOR]
[COLOR=#BB2CA2]@implementation[COLOR=#000000] Table[/COLOR][/COLOR]
[COLOR=#bb2ca2]@synthesize[/COLOR] owntableView,headView,headLabel;
- ([COLOR=#bb2ca2]void[/COLOR])viewDidLoad
{
[COLOR=#3D1D81][COLOR=#000000] [[/COLOR][COLOR=#bb2ca2]super[/COLOR]viewDidLoad[COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#008400]// Do any additional setup after loading the view.[/COLOR]
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#703daa]title[/COLOR] = [COLOR=#d12f1b]@"Test"[/COLOR];
[COLOR=#008400]//Ini TabkeView[/COLOR]
[COLOR=#3D1D81][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#4f8187]owntableView[/COLOR][COLOR=#000000] = [[[/COLOR][COLOR=#703daa]UITableView[/COLOR]alloc[COLOR=#000000]][/COLOR]initWithFrame[COLOR=#000000]:[/COLOR]CGRectMake[COLOR=#000000]([/COLOR][COLOR=#272ad8]20[/COLOR][COLOR=#000000], [/COLOR][COLOR=#272ad8]150[/COLOR][COLOR=#000000], [/COLOR][COLOR=#272ad8]280[/COLOR][COLOR=#000000], [/COLOR][COLOR=#272ad8]250[/COLOR][COLOR=#000000]) [/COLOR]style[COLOR=#000000]:[/COLOR]UITableViewStyleGrouped[COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#3D1D81][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#4f8187]owntableView[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]separatorStyle[/COLOR][COLOR=#000000] = [/COLOR]UITableViewCellSeparatorStyleNone[COLOR=#000000];[/COLOR][/COLOR]
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#4f8187]owntableView[/COLOR].[COLOR=#703daa]backgroundColor[/COLOR] = [[COLOR=#703daa]UIColor[/COLOR] [COLOR=#3d1d81]clearColor[/COLOR]];
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#4f8187]owntableView[/COLOR].[COLOR=#703daa]rowHeight[/COLOR] = [COLOR=#272ad8]50[/COLOR];
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#4f8187]owntableView[/COLOR].[COLOR=#703daa]scrollEnabled[/COLOR] = [COLOR=#bb2ca2]YES[/COLOR];
[COLOR=#703DAA][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#4f8187]owntableView[/COLOR][COLOR=#000000].[/COLOR]userInteractionEnabled[COLOR=#000000] = [/COLOR][COLOR=#bb2ca2]YES[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#4f8187]owntableView[/COLOR].[COLOR=#703daa]allowsSelection[/COLOR] = [COLOR=#bb2ca2]YES[/COLOR];
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#4f8187]owntableView[/COLOR].[COLOR=#703daa]bounces[/COLOR] = [COLOR=#bb2ca2]YES[/COLOR];
[COLOR=#703DAA][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#4f8187]owntableView[/COLOR][COLOR=#000000].[/COLOR]showsVerticalScrollIndicator[COLOR=#000000] = [/COLOR][COLOR=#bb2ca2]YES[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
[COLOR=#703daa]UIImageView[/COLOR] *imageView = [[[COLOR=#703daa]UIImageView[/COLOR] [COLOR=#3d1d81]alloc[/COLOR]] [COLOR=#3d1d81]initWithImage[/COLOR]:[[COLOR=#703daa]UIImage[/COLOR] [COLOR=#3d1d81]imageNamed[/COLOR]:[COLOR=#d12f1b]@"DarkYelloq.png"[/COLOR]]];
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#4f8187]owntableView[/COLOR].[COLOR=#703daa]backgroundView[/COLOR] = imageView;
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#4f8187]owntableView[/COLOR].[COLOR=#703daa]delegate[/COLOR] = [COLOR=#bb2ca2]self[/COLOR];
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#4f8187]owntableView[/COLOR].[COLOR=#703daa]dataSource[/COLOR] = [COLOR=#bb2ca2]self[/COLOR];
[COLOR=#D12F1B][COLOR=#3d1d81]NSLog[/COLOR][COLOR=#000000]([/COLOR]@"delegate:%@ dataSource:%@"[COLOR=#000000], [/COLOR][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#4f8187]owntableView[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]delegate[/COLOR][COLOR=#000000], [/COLOR][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#4f8187]owntableView[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]dataSource[/COLOR][COLOR=#000000]);[/COLOR][/COLOR]
[COLOR=#4F8187][COLOR=#000000] [[/COLOR][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR]owntableView[COLOR=#3d1d81]reloadData[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#008400]//BackGround Image scale to size[/COLOR]
[COLOR=#3D1D81]UIGraphicsBeginImageContext[COLOR=#000000]([/COLOR][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]view[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]frame[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]size[/COLOR][COLOR=#000000]);[/COLOR][/COLOR]
[COLOR=#3D1D81][COLOR=#000000] [[[/COLOR][COLOR=#703daa]UIImage[/COLOR]imageNamed[COLOR=#000000]:[/COLOR][COLOR=#d12f1b]@"BlackFrog.png"[/COLOR][COLOR=#000000]] [/COLOR]drawInRect[COLOR=#000000]:[/COLOR][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]view[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]bounds[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#3D1D81][COLOR=#703daa]UIImage[/COLOR][COLOR=#000000] *tmpui = [/COLOR]UIGraphicsGetImageFromCurrentImageContext[COLOR=#000000]();[/COLOR][/COLOR]
[COLOR=#3D1D81]UIGraphicsEndImageContext[COLOR=#000000]();[/COLOR][/COLOR]
[COLOR=#703daa]UIImageView[/COLOR] *main_background = [[[COLOR=#703daa]UIImageView[/COLOR] [COLOR=#3d1d81]alloc[/COLOR]] [COLOR=#3d1d81]initWithImage[/COLOR]:tmpui];
[COLOR=#bb2ca2]self[/COLOR].[COLOR=#703daa]view[/COLOR] = main_background;
[COLOR=#3D1D81][COLOR=#4f8187]headView[/COLOR][COLOR=#000000] = [[[/COLOR][COLOR=#703daa]UIView[/COLOR]alloc[COLOR=#000000]][/COLOR]initWithFrame[COLOR=#000000]:[/COLOR]CGRectMake[COLOR=#000000]([/COLOR][COLOR=#272ad8]0[/COLOR][COLOR=#000000], [/COLOR][COLOR=#272ad8]0[/COLOR][COLOR=#000000], [/COLOR][COLOR=#272ad8]280[/COLOR][COLOR=#000000], [/COLOR][COLOR=#272ad8]60[/COLOR][COLOR=#000000])];[/COLOR][/COLOR]
[COLOR=#008400]//Ueberschrift wird design und beschriftet[/COLOR]
[COLOR=#3D1D81][COLOR=#4f8187]headLabel[/COLOR][COLOR=#000000] = [[[/COLOR][COLOR=#703daa]UILabel[/COLOR]alloc[COLOR=#000000]][/COLOR]initWithFrame[COLOR=#000000]:[/COLOR]CGRectMake[COLOR=#000000]([/COLOR][COLOR=#272ad8]10[/COLOR][COLOR=#000000], [/COLOR][COLOR=#272ad8]20[/COLOR][COLOR=#000000], [/COLOR][COLOR=#272ad8]280[/COLOR][COLOR=#000000], [/COLOR][COLOR=#272ad8]40[/COLOR][COLOR=#000000])];[/COLOR][/COLOR]
[COLOR=#78492A][COLOR=#4f8187]headLabel[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]text[/COLOR][COLOR=#000000] = [/COLOR]NSLocalizedString[COLOR=#000000]([/COLOR][COLOR=#d12f1b]@"Frogs"[/COLOR][COLOR=#000000], [/COLOR][COLOR=#d12f1b]@""[/COLOR][COLOR=#000000]);[/COLOR][/COLOR]
[COLOR=#703DAA][COLOR=#4f8187]headLabel[/COLOR][COLOR=#000000].[/COLOR]textColor[COLOR=#000000] = [[/COLOR]UIColor[COLOR=#3d1d81]blueColor[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#703DAA][COLOR=#4f8187]headLabel[/COLOR][COLOR=#000000].[/COLOR]shadowColor[COLOR=#000000] = [[/COLOR]UIColor[COLOR=#3d1d81]blackColor[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#4f8187]headLabel[/COLOR].[COLOR=#703daa]shadowOffset[/COLOR] = [COLOR=#3d1d81]CGSizeMake[/COLOR]([COLOR=#272ad8]0[/COLOR], [COLOR=#272ad8]1[/COLOR]);
[COLOR=#4f8187]headLabel[/COLOR].[COLOR=#703daa]font[/COLOR] = [[COLOR=#703daa]UIFont[/COLOR] [COLOR=#3d1d81]boldSystemFontOfSize[/COLOR]:[COLOR=#272ad8]22[/COLOR]];
[COLOR=#703DAA][COLOR=#4f8187]headLabel[/COLOR][COLOR=#000000].[/COLOR]backgroundColor[COLOR=#000000] = [[/COLOR]UIColor[COLOR=#3d1d81]clearColor[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#4F8187][COLOR=#000000] [[/COLOR]headView[COLOR=#3d1d81]addSubview[/COLOR][COLOR=#000000]:[/COLOR]headLabel[COLOR=#000000]];[/COLOR][/COLOR]
[[COLOR=#bb2ca2]self[/COLOR].[COLOR=#703daa]view[/COLOR] [COLOR=#3d1d81]addSubview[/COLOR]:[COLOR=#bb2ca2]self[/COLOR].[COLOR=#4f8187]headLabel[/COLOR]];
[COLOR=#4F8187][COLOR=#000000] [[/COLOR][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#703daa]view[/COLOR][COLOR=#3d1d81]addSubview[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000].[/COLOR]owntableView[COLOR=#000000]];[/COLOR][/COLOR]
}
- ([COLOR=#bb2ca2]void[/COLOR])didReceiveMemoryWarning
{
[COLOR=#3D1D81][COLOR=#000000] [[/COLOR][COLOR=#bb2ca2]super[/COLOR]didReceiveMemoryWarning[COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#008400]// Dispose of any resources that can be recreated.[/COLOR]
}
- ([COLOR=#703daa]NSInteger[/COLOR])numberOfSectionsInTableView:([COLOR=#703daa]UITableView[/COLOR] *)tableView
{
[COLOR=#008400]// Return the number of sections.[/COLOR]
[COLOR=#bb2ca2]return[/COLOR] [COLOR=#272ad8]1[/COLOR];
}
- ([COLOR=#703daa]NSInteger[/COLOR])tableView:([COLOR=#703daa]UITableView[/COLOR] *)tableView numberOfRowsInSection:([COLOR=#703daa]NSInteger[/COLOR])section
{
[COLOR=#008400]// Return the number of rows in the section.[/COLOR]
[COLOR=#bb2ca2]return[/COLOR] 5;
}
- ([COLOR=#703daa]UITableViewCell[/COLOR] *)tableView:([COLOR=#703daa]UITableView[/COLOR] *)tableView cellForRowAtIndexPath:([COLOR=#703daa]NSIndexPath[/COLOR] *)indexPath
{
[COLOR=#bb2ca2]static[/COLOR] [COLOR=#703daa]NSString[/COLOR] *CellIdentifier = [COLOR=#d12f1b]@"Cell"[/COLOR];
[COLOR=#703daa]UITableViewCell[/COLOR] *cell = ([COLOR=#703daa]UITableViewCell[/COLOR] *)[tableView [COLOR=#3d1d81]dequeueReusableCellWithIdentifier[/COLOR]:CellIdentifier];
[COLOR=#bb2ca2]if[/COLOR] (cell==[COLOR=#bb2ca2]nil[/COLOR]) {
[COLOR=#3D1D81][COLOR=#000000] cell = [[[/COLOR][COLOR=#703daa]UITableViewCell[/COLOR]alloc[COLOR=#000000]][/COLOR]initWithStyle[COLOR=#000000]:[/COLOR]UITableViewCellStyleDefaultreuseIdentifier[COLOR=#000000]:CellIdentifier];[/COLOR][/COLOR]
}
[COLOR=#008400]// Configure the cell..[/COLOR]
[COLOR=#703DAA][COLOR=#000000] cell.[/COLOR]textLabel[COLOR=#000000].[/COLOR]text = @"Test";[/COLOR]
[COLOR=#703DAA][COLOR=#bb2ca2]return[/COLOR][COLOR=#000000] ([/COLOR]UITableViewCell[COLOR=#000000] *)cell;[/COLOR][/COLOR]
}
-([COLOR=#703daa]NSIndexPath[/COLOR] *)tableView:([COLOR=#703daa]UITableView[/COLOR] *)tableView willSelectRowAtIndexPath:([COLOR=#703daa]NSIndexPath[/COLOR] *)indexPath{
[COLOR=#D12F1B][COLOR=#3d1d81]NSLog[/COLOR][COLOR=#000000]([/COLOR]@"UITableView WIll Select Row"[COLOR=#000000]);[/COLOR][/COLOR]
[COLOR=#bb2ca2]return[/COLOR] indexPath;
}
-([COLOR=#bb2ca2]void[/COLOR])tableView:([COLOR=#703daa]UITableView[/COLOR] *)tableView didSelectRowAtIndexPath:([COLOR=#703daa]NSIndexPath[/COLOR] *)indexPath{
[COLOR=#3D1D81][COLOR=#000000] [tableView [/COLOR]deselectRowAtIndexPath[COLOR=#000000]:indexPath [/COLOR]animated[COLOR=#000000]:[/COLOR][COLOR=#bb2ca2]YES[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#D12F1B][COLOR=#3d1d81]NSLog[/COLOR][COLOR=#000000]([/COLOR]@"UITableView Select Row %d"[COLOR=#000000],indexPath.[/COLOR][COLOR=#703daa]row[/COLOR][COLOR=#000000]);[/COLOR][/COLOR]
}
-([COLOR=#bb2ca2]void[/COLOR])tableView:([COLOR=#703daa]UITableView[/COLOR] *)tableView didDeselectRowAtIndexPath:([COLOR=#703daa]NSIndexPath[/COLOR] *)indexPath{
[COLOR=#3d1d81]NSLog[/COLOR]([COLOR=#d12f1b]@"deselect %d row"[/COLOR],indexPath.[COLOR=#703daa]row[/COLOR]);
}
[COLOR=#78492A]#pragma marc EditingStyle[/COLOR]
[COLOR=#008400]// Override to support editing the table view.[/COLOR]
- ([COLOR=#bb2ca2]void[/COLOR])tableView:([COLOR=#703daa]UITableView[/COLOR] *)tableView commitEditingStyle:([COLOR=#703daa]UITableViewCellEditingStyle[/COLOR])editingStyle forRowAtIndexPath:([COLOR=#703daa]NSIndexPath[/COLOR] *)indexPath {
[COLOR=#3D1D81][COLOR=#bb2ca2]if[/COLOR][COLOR=#000000] (editingStyle == [/COLOR]UITableViewCellEditingStyleDelete[COLOR=#000000]) {[/COLOR][/COLOR]
[COLOR=#3D1D81][COLOR=#000000] [tableView [/COLOR]deleteRowsAtIndexPaths[COLOR=#000000]:[[/COLOR][COLOR=#703daa]NSArray[/COLOR]arrayWithObject[COLOR=#000000]:indexPath] [/COLOR]withRowAnimation[COLOR=#000000]:[/COLOR]UITableViewRowAnimationFade[COLOR=#000000]];[/COLOR][/COLOR]
}
}
vielleicht wisst ihr noch einen Rat, den ich finde den Fehler nicht.
Ich bedanke mich schon mal bei denen die den Post hier Lesen und eventuell eine Antwort darauf wissen.
Mit freundlichen Grüssen
BluyMul
Projekt:
Anhang anzeigen Apfeltalk.zip
Als zip hinterlegt
Zuletzt bearbeitet: