PFQueryTableView not Updating/How to Update - ios

new day new Problem I guess.
I'm using JASidePanel with 5 Buttons in it,each button Changes the Value of a Variable.
The Variable is used in MyTableController.m as parseClassName.
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom the table
// The className to query on
if (_sDay==Nil) {
self.parseClassName = #"Montag";
}else{
self.parseClassName = self.sDay;
}
// The key of the PFObject to display in the label of the default cell style
self.textKey = #"Fach";
// Whether the built-in pull-to-refresh is enabled
self.pullToRefreshEnabled = YES;
// Whether the built-in pagination is enabled
self.paginationEnabled = NO;
// The number of objects to show per page
self.objectsPerPage = 5;
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"hintergrund"]];
imageView .frame = CGRectMake(0,0,255,458);
[self.view addSubview:imageView];
CGRect frameBtn = CGRectMake(0.0f, 0.0f, 254.0f, 50.0f);
self.bMonday = [UIButton buttonWithType:UIButtonTypeCustom];
[self.bMonday setBackgroundImage:[UIImage imageNamed:#"button_rechts_1"] forState:UIControlStateNormal];
[self.bMonday setTitle:#"Montag" forState:UIControlStateNormal];
[self.bMonday setFrame:frameBtn];
[self.bMonday addTarget:self
action:#selector(monday:)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.bMonday];
CGRect frameBtn2 = CGRectMake(0.0f, 50.0f, 254.0f, 50.0f);
self.bTuesday = [UIButton buttonWithType:UIButtonTypeCustom];
[self.bTuesday setBackgroundImage:[UIImage imageNamed:#"button_rechts_1"] forState:UIControlStateNormal];
[self.bTuesday setTitle:#"Dienstag" forState:UIControlStateNormal];
[self.bTuesday setFrame:frameBtn2];
[self.bTuesday addTarget:self
action:#selector(tuesday:)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.bTuesday];
CGRect frameBtn3 = CGRectMake(0.0f, 100.0f, 254.0f, 50.0f);
self.bWendsday = [UIButton buttonWithType:UIButtonTypeCustom];
[self.bWendsday setBackgroundImage:[UIImage imageNamed:#"button_rechts_1"] forState:UIControlStateNormal];
[self.bWendsday setTitle:#"Mittwoch" forState:UIControlStateNormal];
[self.bWendsday setFrame:frameBtn3];
[self.bWendsday addTarget:self
action:#selector(wendsday:)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.bWendsday];
CGRect frameBtn4 = CGRectMake(0.0f, 150.0f, 254.0f, 50.0f);
self.bThursday = [UIButton buttonWithType:UIButtonTypeCustom];
[self.bThursday setBackgroundImage:[UIImage imageNamed:#"button_rechts_1"] forState:UIControlStateNormal];
[self.bThursday setTitle:#"Donnerstag" forState:UIControlStateNormal];
[self.bThursday setFrame:frameBtn4];
[self.bThursday addTarget:self
action:#selector(thursday:)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.bThursday];
CGRect frameBtn5 = CGRectMake(0.0f, 200.0f, 254.0f, 50.0f);
self.bFriday = [UIButton buttonWithType:UIButtonTypeCustom];
[self.bFriday setBackgroundImage:[UIImage imageNamed:#"button_rechts_1"] forState:UIControlStateNormal];
[self.bFriday setTitle:#"Freitag" forState:UIControlStateNormal];
[self.bFriday setFrame:frameBtn5];
[self.bFriday addTarget:self
action:#selector(friday:)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.bFriday];
}
-(void)monday:(id)sender {
UINavigationController *navController = (UINavigationController*) self.sidePanelController.centerPanel;
MyTableController *myNewTableController = (MyTableController*)[navController.viewControllers objectAtIndex:0];
myNewTableController.sDay = #"Montag";
NSLog(#"%#",myNewTableController.sDay);
}
-(void)tuesday:(id)sender {
UINavigationController *navController = (UINavigationController*) self.sidePanelController.centerPanel;
MyTableController *myNewTableController = (MyTableController*)[navController.viewControllers objectAtIndex:0];
myNewTableController.sDay = #"Dienstag";
NSLog(#"%#",myNewTableController.sDay);
}
-(void)wendsday:(id)sender {
UINavigationController *navController = (UINavigationController*) self.sidePanelController.centerPanel;
MyTableController *myNewTableController = (MyTableController*)[navController.viewControllers objectAtIndex:0];
myNewTableController.sDay = #"Mittwoch";
NSLog(#"%#",myNewTableController.sDay);
}
-(void)thursday:(id)sender {
UINavigationController *navController = (UINavigationController*) self.sidePanelController.centerPanel;
MyTableController *myNewTableController = (MyTableController*)[navController.viewControllers objectAtIndex:0];
myNewTableController.sDay = #"Donnerstag";
NSLog(#"%#",myNewTableController.sDay);
}
-(void)friday:(id)sender {
UINavigationController *navController = (UINavigationController*) self.sidePanelController.centerPanel;
MyTableController *myNewTableController = (MyTableController*)[navController.viewControllers objectAtIndex:0];
myNewTableController.sDay = #"Freitag";
NSLog(#"%#",myNewTableController.sDay);
}
The Problem now is that the PFQueryUITableView isn't displaying the content of the new parseClass, does anybody have an Idea why?
Thanks alot in advance!

In your monday ... friday methods, you're setting sDay but you're not changing the value stored in parseClassName. One way you could fix it would be to add the following to each of your methods
myNewTableController.parseClassName = #"SOME VALUE";
Another option would be to customize the setter for sDay so that it updates parseClassName the code would look like the following
- (void)setSDay:(NSString *)sDay
{
if (![_sDay isEqualToString:sDay]) {
_sDay = sDay;
self.parseClassName = sDay;
}
}

Related

UIButton image does not show in Navigation Bar

I am trying to a slide menu. The only problem is that the image for the UIButton does not show at runtime. This is the code I have written.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(NSString *)segueIdentifierForIndexPathInLeftMenu:(NSIndexPath *)indexPath
{
NSString *identifier;
switch (indexPath.row) {
case 0:
identifier=#"firstSegue";
break;
case 1:
identifier=#"secondSegue";
break;
}
return identifier;
}
-(void)configureLeftMenuButton:(UIButton *)button
{
CGRect frame = button.frame;
frame.origin=(CGPoint){0.0};
frame.size = (CGSize){40.40};
button.frame = frame;
[button setImage:[UIImage imageNamed:#"icon-menu"] forState:UIControlStateNormal];
}
I suppose you are using navigation controller. If so, implementation could look like:
- (void)viewDidLoad
{
[super viewDidLoad];
[self configureLeftMenuButton];
}
-(void)configureLeftMenuButton
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[UIImage imageNamed:#"icon-menu"] forState:UIControlStateNormal];
button.frame = CGRectMake(0.0f, 0.0f, 44.0f, 44.0f);
[button addTarget:self
action:#selector(yourAction:)
forControlEvents:UIControlStateNormal];
UIBarButtonItem *menuItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.leftBarButtonItem = menuItem;
}

Undeclared identifier "viewDidLoad"

//Objects list
//objects scroll
UIScrollView *objects;
objects=[[UIScrollView alloc]initWithFrame:CGRectMake(0,80,512,688)];
objects.showsVerticalScrollIndicator=YES;
objects.scrollEnabled=YES;
objects.userInteractionEnabled=YES;
objects.backgroundColor = [UIColor clearColor];
[self.view addSubview:objects];
[objects setUserInteractionEnabled:YES];
[objects setCanCancelContentTouches:YES];
objects.contentSize = CGSizeMake(512,689);
//divider
UIButton *divider = [UIButton buttonWithType:UIButtonTypeCustom];
[divider setBackgroundImage:[UIImage imageNamed:#"white.png"]forState:UIControlStateNormal];
divider.frame = CGRectMake(300, 0, 1, 768);
[divider setTitle:#"" forState:UIControlStateNormal];
[self.view addSubview:divider];
divider.adjustsImageWhenHighlighted = NO;
//array colors
UIImage *color[3000];
//color setup
color[0] = [UIImage imageNamed:#"item.png"];
UIImageView *originalImageView = [[UIImageView alloc] initWithImage:color[0]];
[originalImageView setFrame:CGRectMake(300, 0, 212, 62)];
[objects addSubview:originalImageView];
//array buttons
UIImageView *button[3000];
//button setup
button[0] = [[UIView alloc] initWithFrame:[originalImageView frame]];
UIImageView *maskImageView = [[UIImageView alloc] initWithImage:color[0]];
[maskImageView setFrame:[button[0] bounds]];
[[button[0] layer] setMask:[maskImageView layer]];
button[0].backgroundColor = [UIColor blueColor];
[objects addSubview:button[0]];
//add object button
UIButton *plus = [UIButton buttonWithType:UIButtonTypeCustom];
[plus setBackgroundImage:[UIImage imageNamed:#"plus.png"]forState:UIControlStateNormal];
plus.frame = CGRectMake(394, 106, 25, 25);
[plus setTitle:#"" forState:UIControlStateNormal];
[objects addSubview:plus];
plus.adjustsImageWhenHighlighted = YES;
-(void)viewDidLoad {
[super viewDidLoad];
UIButton *add = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[add addTarget:self action:#selector(aMethod:)forControlEvents:UIControlEventTouchDown];
[add setTitle:#"add new" forState:UIControlStateNormal];
add.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:add];
}
- (void) aMethod:(id)sender {
button[0].backgroundColor = [UIColor greenColor];
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
Here is the updated code, some before, and everything after. There's a lot more to the program but it is all just setting up different visual elements for a GUI. The error is tagged on the line that sais..
-(void)viewDidLoad {
And the error sais this..
Use of undeclared identifier 'viewDidLoad'
Would you like more info??
you cannot have method inside another method.
this is part of your code
//add object button
UIButton *plus = [UIButton buttonWithType:UIButtonTypeCustom];
[plus setBackgroundImage:[UIImage imageNamed:#"plus.png"]forState:UIControlStateNormal];
plus.frame = CGRectMake(394, 106, 25, 25);
[plus setTitle:#"" forState:UIControlStateNormal];
[objects addSubview:plus];
plus.adjustsImageWhenHighlighted = YES;
-(void)viewDidLoad {
[super viewDidLoad];
UIButton *add = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[add addTarget:self action:#selector(aMethod:)forControlEvents:UIControlEventTouchDown];
[add setTitle:#"add new" forState:UIControlStateNormal];
add.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:add];
}
- (void) aMethod:(id)sender {
button[0].backgroundColor = [UIColor greenColor];
}
} // <----this should not be here
change it to
//add object button
UIButton *plus = [UIButton buttonWithType:UIButtonTypeCustom];
[plus setBackgroundImage:[UIImage imageNamed:#"plus.png"]forState:UIControlStateNormal];
plus.frame = CGRectMake(394, 106, 25, 25);
[plus setTitle:#"" forState:UIControlStateNormal];
[objects addSubview:plus];
plus.adjustsImageWhenHighlighted = YES;
} // <--- should be here to end method
-(void)viewDidLoad {
[super viewDidLoad];
UIButton *add = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[add addTarget:self action:#selector(aMethod:)forControlEvents:UIControlEventTouchDown];
[add setTitle:#"add new" forState:UIControlStateNormal];
add.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:add];
}
- (void) aMethod:(id)sender {
button[0].backgroundColor = [UIColor greenColor];
}

How to get index of uiimage subview of uiscrollview

I need to detect selected image of uiimage which is placed inside scrollview.
My code is here:
int newscrollviewY = 40;
for(int i = 0; i<1; i++)
{
scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(5, newscrollviewY, 310, 100)];
scrollView.showsVerticalScrollIndicator = YES;
scrollView.scrollEnabled = YES;
scrollView.userInteractionEnabled = YES;
scrollView.backgroundColor = [UIColor clearColor];
scrollView.delegate=self;
int imgx = 1;
for(int img=0; img<[images count]; img++)
{
UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(imgx,0,100,100)];
imageView1.backgroundColor = [UIColor whiteColor];
imageView1.image = [images objectAtIndex:img];
imageView1.contentMode = UIViewContentModeScaleAspectFit;
[imageView1 setNeedsDisplay];
[imageView1 setUserInteractionEnabled:YES];
[imageView1 setMultipleTouchEnabled:YES];
[scrollView addSubview:imageView1];
imageButton = [UIButton buttonWithType:UIButtonTypeCustom];
imageButton.frame = CGRectMake(imgx,0,100,100);
[imageButton addTarget:self action:#selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
imageButton.tag = img;
[scrollView addSubview:imageButton];
imgx = imgx + 103;
}
Please help to detect selected image using imageButton or something else.
Replace your selector with buttonClicked:
be Sure that you are adding ":" after selector method. follow or replace the code below:
[imageButton addTarget:self action:#selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
then Add the selector definantion in .m file
- (void) buttonClicked: (id) sender
{
// here you can get the tag of button.
NSInteger tag = ((UIButton *)sender).tag;
// do your implementation after this
}
Hope this will solve your issue. Enjoy Coding..!!
They way you have set it up the tag of the 'button' is already the number of the image in your array of images. So all you need to do is get the tag from the 'button'.
Make sure the button clicked function retrieves the tag from the sender(id) that you receive.
For example a bit like this:
- (IBAction)buttonClicked:(id)sender {
UIButton *button = (UIButton *)sender;
UIImage selectedImages = [images objectForKey: [button tag]];
}
As par you question if you are using UIImageview you have to use UITapGestureRecognizer that same like Button. you just need to add UITapGestureRecognizer like:-
for(int img=0; img<[images count]; img++)
{
UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(imgx,0,100,100)];
imageView1.backgroundColor = [UIColor whiteColor];
UITapGestureRecognizer *frameTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(frameTapGesture:)];
frameTapGesture.numberOfTapsRequired=1;
imageView1.image = [images objectAtIndex:img];
imageView1.contentMode = UIViewContentModeScaleAspectFit;
[imageView1 setNeedsDisplay];
[imageView1 setUserInteractionEnabled:YES];
[imageView1 setMultipleTouchEnabled:YES];
imageView1.tag=img;
[_imgView addGestureRecognizer:frameTapGesture];
[scrollView addSubview:imageView1];
}.
- (void)frameTapGesture:(UITapGestureRecognizer*)sender
{
UIView *view = sender.view; //cast pointer to the derived class if needed
NSLog(#"%d", view.tag);
}
Reduce your code There are No need to add Button with same Frame of ImageView For getting Click Event or you can also set Image of UIButton for you want to like use UIBUtton then remove UIImageview Code else you simply use UITapGestureRecognizer with getting click event using - (void)frameTapGesture:(UITapGestureRecognizer*)sender
Please try this code
for(int img=0; img<[images count]; img++)
{
imageButton = [UIButton buttonWithType:UIButtonTypeCustom];
[imageButton setImage:[UIImage imageNamed:[images objectAtIndex:i]] forState:UIControlStateNormal];
imageButton.frame = CGRectMake(imgx,0,100,100);
[imageButton addTarget:self action:#selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
imageButton.tag = img;
[scrollView addSubview:imageButton];
imgx = imgx + 103;
}
- (void) buttonClicked: (id) sender
{
UIButton *button = (UIButton *)sender;
UIImage selectedImage = button.currentImage;
}
set button target
[button addTarget:self action:#selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
// get Button Action
-(void) buttonAction:(UIButton *)sender
{
NSLog(#"%dl",sender.tag);
// do your implementation after this
}

iOS Subview with buttons not responding to touches.

I have a UIView Subclass that has a frame/image with buttons in it. I'm trying to add it to my view controller however when I do it shows up but none of the buttons will register ANY touches.
Here is my UIView Subclass.
#import "ControlView.h"
#implementation ControlView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
CGRect slideFrame = CGRectMake(0, 402, 320, 82);
slider = [[UIView alloc] initWithFrame:slideFrame];
slider.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:#"shelf.png"]];
[self addSubview:slider];
UIImage *btnImage = [UIImage imageNamed:#"NavBar_01.png"];
UIImage *btnImageSelected = [UIImage imageNamed:#"NavBar_01_s.png"];
btnImage = [UIImage imageNamed:#"NavBar_01.png"];
btnImageSelected = [UIImage imageNamed:#"NavBar_01_s.png"];
btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
btn1.frame = CGRectMake(12, 28, 70, 50);
[btn1 setBackgroundImage:btnImage forState:UIControlStateNormal];
[btn1 setBackgroundImage:btnImageSelected forState:UIControlStateSelected];
[slider addSubview:btn1];
[slider bringSubviewToFront:btn1];
[btn1 addTarget:self action:#selector(home) forControlEvents:UIControlEventTouchUpInside];
btnImage = [UIImage imageNamed:#"NavBar_02.png"];
btnImageSelected = [UIImage imageNamed:#"NavBar_02_s.png"];
btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
btn2.frame = CGRectMake(87, 28, 70, 50);
[btn2 setBackgroundImage:btnImage forState:UIControlStateNormal];
[btn2 setBackgroundImage:btnImageSelected forState:UIControlStateSelected];
[slider addSubview:btn2];
[slider bringSubviewToFront:btn2];
// [btn2 addTarget:self action:#selector() forControlEvents:UIControlEventTouchUpInside];
btnImage = [UIImage imageNamed:#"NavBar_03.png"];
btnImageSelected = [UIImage imageNamed:#"NavBar_03_s.png"];
btn3 = [UIButton buttonWithType:UIButtonTypeCustom];
btn3.frame = CGRectMake(162, 28, 70, 50);
[btn3 setBackgroundImage:btnImage forState:UIControlStateNormal];
[btn3 setBackgroundImage:btnImageSelected forState:UIControlStateSelected];
[slider addSubview:btn3];
[slider bringSubviewToFront:btn3];
// [btn3 addTarget:self action:#selector() forControlEvents:UIControlEventTouchUpInside];
btnImage = [UIImage imageNamed:#"NavBar_04.png"];
btnImageSelected = [UIImage imageNamed:#"NavBar_04_s.png"];
btn4 = [UIButton buttonWithType:UIButtonTypeCustom];
btn4.frame = CGRectMake(237, 28, 70, 50);
[btn4 setBackgroundImage:btnImage forState:UIControlStateNormal];
[btn4 setBackgroundImage:btnImageSelected forState:UIControlStateSelected];
[slider addSubview:btn4];
[slider bringSubviewToFront:btn4];
// [btn4 addTarget:self action:#selector() forControlEvents:UIControlEventTouchUpInside];
UISwipeGestureRecognizer *recognizer;
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:#selector(slideUp)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionUp)];
[self addGestureRecognizer:recognizer];
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:#selector(slideDown)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionDown)];
[self addGestureRecognizer:recognizer];
}
return self;
}
-(void)slideUp
{
// Slide up based on y axis
CGRect frame = slider.frame;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.75];
frame.origin.y = 320;
slider.frame = frame;
[UIView commitAnimations];
}
-(void)slideDown
{
CGRect frame = slider.frame;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.75];
frame.origin.y = 425;
slider.frame = frame;
[UIView commitAnimations];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
#end
And this is how I'm adding it to my ViewController.
ControlView *cont = [[ControlView alloc]init];
[homeView.view addSubview:cont];
I tried adding the same code to a ViewController and the buttons etc.. worked so I'm sure this is something simple/stupid with Delegates/Self etc.. between the subview and the ViewController however I have a mental block.
You are doing this?
ControlView *cont = [[ControlView alloc]init];
you are supposed to do
ControlView *cont = [[ControlView alloc]initWithFrame:self.view.frame];

iPad popover presentpopoverfrombarbuttonitem

I have added a few buttons to the right side of the navigation bar with the following:
UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
customView.backgroundColor = [UIColor clearColor];
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, 45, 44);
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
button.backgroundColor = [UIColor clearColor];
[button setImage:[UIImage imageNamed:#"toc.png"] forState:UIControlStateNormal];
button.userInteractionEnabled = YES;
[button addTarget:self action:#selector(tableOfContentsAction) forControlEvents:UIControlEventTouchUpInside];
[customView addSubview:button];
button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(50, 0, 45, 44);
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
button.backgroundColor = [UIColor clearColor];
[button setImage:[UIImage imageNamed:#"bookmark.png"] forState:UIControlStateNormal];
button.userInteractionEnabled = YES;
[button addTarget:self action:#selector(bookmarkButtonAction) forControlEvents:UIControlEventTouchUpInside];
[customView addSubview:button];
UIBarButtonItem *segmentBarItem = [[UIBarButtonItem alloc] initWithCustomView:customView];
self.navigationItem.rightBarButtonItem = segmentBarItem;
[customView release];
[segmentBarItem release];
This works well. For both buttons I show a popOver as shown below
- (void) bookmarkButtonAction
{
BookmarksViewController* content = [[BookmarksViewController alloc] initWithOrientation:lastOrientation selectedPage:selectedPage];
UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:content];
CGSize size = content.view.frame.size;
aPopover.popoverContentSize = size;
aPopover.delegate = self;
self.bookmarksPopoverVC = content;
self.bookmarksPopoverVC.popUpController = aPopover;
[content release];
[aPopover presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[aPopover release];
bookmarksShowing = YES;
}
The problem is that I am using presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem and this shows the top arrow in the middle of the two buttons. How can I attach the arrow to each button?
instead of using this line:
aPopover presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem
You may better try this line:
aPopover presentPopoverFromBarButtonItem:sender
I think that would solve your problem
try this:
- (IBAction)products:(id)sender {
UIButton* btn = (UIButton *)sender;
[productsPopover presentPopoverFromRect:[btn bounds] inView:btn permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
Works like a charm

Resources