Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The project available on git-hub <a href="https://github.com/50pixels/FPPopover/tree/master/FPPopoverDemo" rel="nofollow">Popover for iPhone</a> will help you to implement the popover in iPhone app.</p> <p>The only thing you need to do is check the device in your above code &amp; perform the actions accordingly.</p> <p>Add 6 files to your project</p> <p><strong>FPPopoverController.h/.m, FPPopoverView.h/m, and FPTouchView.h/.m</strong> </p> <p>then create two sample </p> <blockquote> <p>DemoPopOverTableController.h</p> </blockquote> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "FPPopoverController.h" @interface DemoPopOverTableController : UITableViewController { FPPopoverController *popOverController; NSArray *subCat; } -(id)initWithStyle:(UITableViewStyle)style andSubCategory:(NSArray *)subCategories -(void)setPopOver:(FPPopoverController*)popOver; @end </code></pre> <p>and </p> <blockquote> <p>DemoPopOverTableController.m</p> </blockquote> <pre><code>#import "DemoPopOverTableController.h" #import "FPPopoverController.h" @interface DemoTableController () @end @implementation DemoTableController -(id)initWithStyle:(UITableViewStyle)style andSubCategory:(NSArray *)subCategories { self = [super init]; if (self) { // Custom initialization subCat = [NSArray arrayWtihArray:subCategories] ; } return self; } -(void)setPopOver:(FPPopoverController *)popOver { popOverController=popOver; } - (void)viewDidLoad { [super viewDidLoad]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } #pragma mark - Table view data source - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [subCat count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; NSString *tempCat=[subCat objectAtIndex:indexPath.row]; cell.textLabel.text =tempCat; return cell ; } #pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"selected Category: %@",[subCat objectAtIndex:indexPath.row]); [popOverController dismissPopoverAnimated:YES]; } @end </code></pre> <p>This is not complete answer but this is something you can do in your above code</p> <pre><code>if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone) { //iPhone popover lines of code DemoPopOverTableController *controller = [[DemoPopOverTableController alloc] initWithStyle:UITableViewStylePlain andSubCategory:subCat]; FPPopoverController *popover = [[FPPopoverController alloc] initWithViewController:controller]; [controller setPopOver:popover]; [controller release]; popover.delegate = self; popover.tint = FPPopoverDefaultTint; popover.arrowDirection = FPPopoverArrowDirectionUp; popover.contentSize = CGSizeMake(200, 200); //sender is the UIButton view [popover presentPopoverFromView:sender]; [popover release]; } else { //the original line of code you have already in your code } </code></pre> <p>And you can implement the delegate methods to perform some actions upon touching teh table view</p> <pre><code>- (void)presentedNewPopoverController:(FPPopoverController *)newPopoverController shouldDismissVisiblePopover:(FPPopoverController*)visiblePopoverController { [visiblePopoverController dismissPopoverAnimated:YES]; [visiblePopoverController autorelease]; } - (void)popoverControllerDidDismissPopover:(FPPopoverController *)popoverController { // do something of your choice } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload