Link to home
Start Free TrialLog in
Avatar of privateson
privateson

asked on

UIMenuController's copy bubble problem

hey, currently I have a small problem with UIMenuController's copy bubble.

My set up is that I have a TableView, and inside the TableView I have bunch of TableViewCells.
Inside each TableViewCells I have a image called balloonView
And I say show me the UIMenuController's menu in the rect which is balloonView's frame(this frame is with respect to the TableViewCell, not with respect to the window.
The problem is whichever row I tap on the table, it will show the copyMenu on same place in the window. I think it is because position of "rect"is with respect to the TableViewCell.
But what I want is that when I tap image of row X, it will show that copy menu on top of the row which i selected. How can I do that?
cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
		balloonView = (UIImageView *)[[cell.contentView viewWithTag:kMessage] viewWithTag:kBallonView];
		rect = [balloonView frame];
		UIMenuController *copyMenu = [UIMenuController sharedMenuController];
		[copyMenu setTargetRect:rect inView:cell.contentView];
		[copyMenu setMenuVisible:YES animated:YES];

Open in new window


Avatar of pgnatyuk
pgnatyuk
Flag of Israel image

It's very difficult to understand - table view, cells, balloons. :) No screenshot at all.
The code looks correct. So, I think your right, and the question is about the rectangle. Or about the view. I think, it is here:
 [copyMenu setTargetRect:rectToPut inView:viewToPut];
Somehow I think there should be the 'self', or view or self.view :) or superview - I do not know where is this code in your app.

Seems like you know all at that posted here:
http://loopingrecursion.com/index.php?t=uimenucontroller
Check again, maybe, it will give you an idea.

Also check Listing 3-15  Displaying the editing menu here:
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/EventHandling/EventHandling.html

ASKER CERTIFIED SOLUTION
Avatar of kouddy
kouddy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial