Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions FPPopoverDemo/DemoTableController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@

#import <UIKit/UIKit.h>

@class FPViewController;
@class DemoTableController;

@protocol DemoTableViewControllerDelegate

- (void)DemoTableControllerDidFinish:(DemoTableController *)controller selectedValue:(NSString *)textSelected;

@end


@interface DemoTableController : UITableViewController
@property(nonatomic,assign) FPViewController *delegate;

@property(weak,nonatomic) id <DemoTableViewControllerDelegate> delegate;

@end
8 changes: 4 additions & 4 deletions FPPopoverDemo/DemoTableController.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
#pragma mark - Table view delegate

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if([self.delegate respondsToSelector:@selector(selectedTableRow:)])
{
[self.delegate selectedTableRow:indexPath.row];
}

[self.delegate DemoTableControllerDidFinish:self selectedValue:[NSString stringWithFormat:@"cell %d",indexPath.row]];

}





@end
4 changes: 3 additions & 1 deletion FPPopoverDemo/FPDemoTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
//

#import <UIKit/UIKit.h>
#import "DemoTableController.h"

@interface FPDemoTableViewController : UITableViewController

@interface FPDemoTableViewController : UITableViewController<DemoTableViewControllerDelegate>

@end
16 changes: 14 additions & 2 deletions FPPopoverDemo/FPDemoTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ @interface FPDemoTableViewController ()

@end

@implementation FPDemoTableViewController
@implementation FPDemoTableViewController {

FPPopoverController *popover;

}

- (id)initWithStyle:(UITableViewStyle)style
{
Expand Down Expand Up @@ -61,7 +65,7 @@ -(void)popover:(id)sender
//the controller we want to present as a popover
DemoTableController *controller = [[DemoTableController alloc] initWithStyle:UITableViewStylePlain];

FPPopoverController *popover = [[FPPopoverController alloc] initWithViewController:controller];
popover = [[FPPopoverController alloc] initWithViewController:controller];

//popover.arrowDirection = FPPopoverArrowDirectionAny;
popover.tint = FPPopoverDefaultTint;
Expand Down Expand Up @@ -118,6 +122,14 @@ - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)
}
*/

- (void)DemoTableControllerDidFinish:(DemoTableController *)controller selectedField:(NSString *)textSelected {

[popover dismissPopoverAnimated:YES];

NSLog(@"textSelected %@",textSelected);

}




Expand Down