Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

01.vipin

macrumors newbie
Original poster
Feb 22, 2011
16
0
Hii ,

I am new to iphone programming. Can i place button on the webview. So that the button will appear when we touch the webview.
 
The web view is more than just a single view. There's at least a scrollview as a subview and probably some other stuff too. Apple considers all the subviews to be private so you're not supposed to mess with them. It might be OK to add a button to the web view directly but it might not work the way you want. You could possibly add a button to a view that floats above the webview.

You might also have a toolbar in the window, like MobileSafari does.

Can you tell more about the effect you're trying to achieve? Why do you want to do this?

I have seen some web links about adding popovers above a webview in response to touching links or other text in a web view. That's a little different though.
 
Very thanx for ur reply.......

Now I am having problem with gesture........!!.It works fine in simulator, But while it works in device it is showing this error.

Code:
    UIGestureRecognizer	*recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
	self.swipeRecognizer = (UISwipeGestureRecognizer *)recognizer;
	swipeRecognizer.direction = UISwipeGestureRecognizerDirectionUp;
	[self.txtMessage addGestureRecognizer:recognizer];
	//recognizer.delegate = self;
	[recognizer release];
Error showing is below
--------------------------


-[UISwipeGestureRecognizer setDirection:]: unrecognized selector sent to instance 0x1b4c10
2011-02-24 10:49:45.625 OnlyGizmos[369:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UISwipeGestureRecognizer setDirection:]: unrecognized selector sent to instance 0x1b4c10'
 
Last edited by a moderator:
Code:
UISwipeGestureRecognizer *Recognizerright = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(Perform_Swipedright:)] autorelease];
	[self.view addGestureRecognizer:Recognizerright];
	Recognizerright.direction = UISwipeGestureRecognizerDirectionRight;

This works fine for me.. sorry :)

PS: try deleting the release, and see what it does (build in the release with the autorelease on my first line.. and also, put it in the view, not on the "txtMessage", just to see whats wrong :)
And that second line is a bit over the top i think.
Just do it a bit mor efficient, like my code i guess :p.
 
I want to use the swipe gesture in the webview.
Here the txtMessage i mentioned is webview. When i changed it to view it is working successfully.

I tried your code, it works fine in simulator.

but while working with the device i get the error

2011-02-25 11:16:25.250 OnlyGizmos[489:207] *** -[UISwipeGestureRecognizer setDirection:]: unrecognized selector sent to instance 0x1b6950
2011-02-25 11:16:25.257 OnlyGizmos[489:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UISwipeGestureRecognizer setDirection:]: unrecognized selector sent to instance 0x1b6950'
2011-02-25 11:16:25.269 OnlyGizmos[489:207] Stack: (
843263261,
825818644,
843267069,
842763033,
842725440,
26283,
844154820,
844283872,
844283288,
844282948,
844281236,
844280752,
844182692,
844181896,
21373,
844473760,
844851728,
862896011,
843011267,
843009055,
860901832,
843738160,
843731504,
11617,
11532
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
(gdb)

Any help please.....
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.