iCulture forum | iPhone, iPad,  iPod touch, Apple TV en iOS

iCulture forum | iPhone, iPad, iPod touch, Apple TV en iOS (https://forum.iculture.nl/)
-   Ontwikkelen voor iOS (https://forum.iculture.nl/f133/development/f58/ontwikkelen-voor-ios/)
-   -   Een video openen vanuit een tableView (https://forum.iculture.nl/f133/development/f58/ontwikkelen-voor-ios/76371-video-openen-vanuit-tableview.html)

Zaankantertje75 28-10-10 12:46

Een video openen vanuit een tableView
 
1 Bijlage(n)
Hee beste mensen,

Ik heb hier een tableView.

Bijlage 9474

als ik op een van de cellen klik wil ik graag een video openen, nu heb ik alleen de code om een video te openen met een aparte knop. en dat link je dan met IB.

Nu denk ik dat je met een cell geen IB connectie kan maken omdat je daar het voorbeeld van de tabel ziet van california enzo. (in IB)

me cell is gecreëerd met deze code:

.m
Code:

- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section
{
        return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView
                cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
        UITableViewCell *cell =
        [tableView dequeueReusableCellWithIdentifier:@"cell"];
       
        // create a cell
        if ( cell == nil)
        {
                cell = [[UITableViewCell alloc]
                                initWithStyle:UITableViewCellStyleSubtitle
                                reuseIdentifier:@"cell"];
        }

        //retrieve an image/ Zet een afbeelding naast de titel
        NSString *imagefile = [[NSBundle mainBundle]
                                                  pathForResource:@"cellimage" ofType:@"png"];
        UIImage *ui = [[UIImage alloc] initWithContentsOfFile:imagefile];
        //set the image on the table cell/ zet hem in de tabel
        cell.imageView.image = ui;
       
       
        //set the main text/hoofd tekst
        cell.textLabel.text = [exercises objectAtIndex:indexPath.row];
       
        //set the subtitle text/ ondertekst
        cell.detailTextLabel.text = @"Management training", @"Ondertiteling hier", @"Ondertiteling hier";
       
        //accessory type /zijn de navigatie pijltjes, er zijn 3 verschillende
        cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
       
        //return the cell
        return cell;
}

/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
        exercises = [[NSArray alloc]
                                initWithObjects:@"BAZO", @"Een minder interessante titel",
                                @"En nog een titel",nil];
       
        self.title = @"Training lijst";
       
        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}


Ik denk dat ik dus programmatisch die koppeling moet maken.

Ik heb hier een code om zo'n methode aan te roepen. maar ik heb deze nog nooit gebruikt weet iemand hoe ik deze toe moet pasen?

Code:

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

Als iemand mij zou kunnen uitleggen hoe? zou ik er blij zijn:)

Tx voor je tijd

Bram


Alle tijden zijn GMT +2. Het is nu 14:47.