My App is written in OpenGL and C++, I do not use XIB file for presentation. So how can I create an href link that the user clicks and takes them someone in the browser?
OpenGL only draws things to the screen. There's no concept of geometric objects. So you'll have to detect a click on the link text and call the appropriate iOS API invoking the URL.
Okay I think I found it:
NSURL *url = [NSURL URLWithString:#"http://www.iphonedevelopertips.com"];
[[UIApplication sharedApplication] openURL:url];
Related
I'm using C++ Builder for Application programming. I want to know how to open an URL on an Ios Device in Safari ( simply on an button click ) . Would be nice if anyone has an answer to that.
You could do
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://www.google.com"]];
For further details Check UIApplication Class Reference
new in ios application development with uikit,can any one tell me what is alternative code of cocos2d replacScene In UiKit.used segue model but problem is i want use it programmatically like cocos2d.
thanks.
you can call the segue programatically by giving it an identifier and then using the following function
[self performSegueWithIdentifier:#"<segue identifier>" sender:<the sending view controller>];
I downloaded iAd Banner Sample for cocos2d V3. Thanks so much for that code. The demo works fine and needs the user to tap Show Ad or Hide Ad button. Of course in my game I do not want the player to tap a button to Show Ads. In IntroScene.m I commented out the code that creates the buttons and added these lines at the end of init:
AppDelegate * app = (((AppDelegate*) [UIApplication sharedApplication].delegate));
[app ShowIAdBanner];
This is the same code that would have been executed if the Show Ad button had been pressed. I expected to see an ad without having to tap a button. However, I got no ad. I got the following error message in the log:
ADBannerView: Unhandled error (no delegate or delegate does not
implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain
Code=2 "The operation couldn’t be completed. Loading throttled"
There is -(void)bannerDidFail method in AppDelegate. It works by tapping button. How do I get the ads to show up automatically, without tapping a button first? Thanks.
The error seems to tell you exactly what is happening. Make sure that you have the following line:
bannerView.delegate = self; //bannerView is an object of type AdBannerView* that you created before
Check also that the class where the previous line is, implements the method:
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
I recently wrote a tutorial on integrating iAds in Cocos2d-x v3. Although the language is different (C++ instead of Objective-C), the procedure and syntax are rather similar: http://becomingindiedev.blogspot.com.es/2015/02/integrating-iad-in-cocos2d-x-v3x.html
I'm a C++/Windows developer getting to grips with iOS AND OBJ-C... can anyone provide sample code how I could iterate through all windows/views belonging to my application and log/print to the debugger some vital information about the size, position, state, etc of each. I'm using a 3rd-party library and am not really understanding exactly what it is creating on my behalf.
In the debugger, you can try:
po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]
Try this:
po [[UIApplication sharedApplication] windows]
I have an app on iOS that works with C++ (a Cocos2DX game). I want to integrate Facebook on it.
I initialize the Facebook iOS SDK as the Facebook developers website indicates it, on a Objective C class. Then I call this Objective-C class from my C++ code, and it seems to work -the Facebook app is opened and asks for authentication and permissions-.
The problem is that the "events" or "callbacks" like fbDidLogin are not called back, or at least I do not have control over them from C++
Do you know if that can be done?
Thks.
Ok, the solution:
All the Facebook related code must be in the AppDelegate.m Then you can access it from anywhere in your code with this instruction:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate FacebookLogin];