I need to load a website in a cocos 2d game.
For example,when a ccmenu button is clicked,i need to replace a scene where it must load an particular website.
Any ideas please,thanks.
It sounds like you want to get game data from a server, correct? In that case, you probably aren't going to want to load an HTML page. Instead, come up with some a method of storing pertinent game data in a more appropriate file format. I can't say for sure because I don't know anything about your game, but saving your game data as XML might work well. Then, when you need to update the game with data from your sever, use an NSURLRequest or similar to download the XML file, which you can then parse as you see fit.
Look into CCHttpRequest or CCHttpClient.
Related
I am making a game that procedurally generates a level and sets tiles via Tilemap.SetTile().
I've been reading and watching tutorials about saving in unity and from what I understand I need to serialize data so it can be saved in a binary file. However, I don't even know where the data about the tiles in the tilemap is being saved.
How could I make this system - where can I find information about stored tiles in a tilemap?
Is there perhaps an already finished saving system that supports Unity tilemaps on the Asset Store?
As already mentioned in a comment, the "serialization" in Unity is absolutely garbage - completely forget about it.
All you do is save the info, probably as JSON, just a text file.
Note that the Json helpers built in to Unity are completely perfect - very easy to use.
Here's a simple and famous example ... https://stackoverflow.com/a/40097623/294884
(Note that you don't literally have to use Json, you can use any simple text format, but Json is so easy you may as well use it.)
There are actually dozens of QA on this site where someone asks "I want to save _ _ _ in Unity, how do I use serialization?" in every single casethe answer is just "Unity serialization is a joke, just save as a text file."
I'm developing an app that I want the user to be able to take a screenshot with a button (this works, but it's stored to camera roll). I have a need to keep history of these screenshots along with site name, etc.
I've been reading that it's not recommended to save binary data in a sqlite db, so I've stumbled across core data. I'm still learning, but one question that comes to mind is this. Some recommend to save the filename to coredata and then save the image to document directory. I want to read the data back into a table view controller and have the image part of the cell. Will I need to resize the image to the size I want when reading in, or will it automatically size down to what it needs?
Also, when saving to document directory, are those files accessible from the camera roll? I don't want them to be and I'd like to give the user the ability to be able to delete them with the tableviewcontroller.
Please let me know if I need to expand on anything. I'm learning Swift, so I'm sure I missed something.
You should not save it to the Documents directory.
You should instead Allow External Storage of the attribute. Core Data will take care of storing it for you. This is explained in the answer by jansenmaarten to this question.
I'm developing an app and one of its features is similar to twitter,so I have a table with each "tweet" and I display the user's picture too and I don't know what is the best way to load a lot of pictures. The images come from the server as an url.
My app's structure is:
1- I call to the server, and I get the response
2- I parse the response and I iterate it creating objects
3- I load that objects in the tableview's store
4- I reload the table
I thought one way is when I am creating the object, I load the image and I assign to the object's attribute. I mean, each time I create a object type "tweet" for example, I create the image calling the url with nsdata...
I dont know if that solution is correct or can be better. Can anyone give me a hand? Thanks in advance
Take a look at the SDWebImage API. It will do much of this automatically for you.
I have seen some tutorials on the subject, but they all go half into it and then leave a person wondering.
How can I stream an rss feed into an iphone app.
I know the xml should be read in, parsed etc.
But then I am not sure how to display the information I need like, images, embedded videos etc.
If someone could just point me in the right direction I would be extremely grateful.
Thanks in advance
First, you need some type of XML parser. You can use the built in NSXMLParser or a slew of other parsers that you will need to download. Each have their pros/cons depending on what type of reading/writing you will be doing with your RSS feed.
To display the data, I would recommend a tableView. You can create custom UITablvewCells for each cell to hold the data however you want to display it. There are several tutorials available for that if you want to Google for it.
As for data, read all the RSS data into an array you create and have the tableView access that array.
Again, there are many online tutorials for this already but it seems like you need help with displaying the data. A quick Google lookup for how to create custom UITableViewCells should provide you lots of helpful links. Good luck.
First, I would to thank everyone for all the help they provide via this website. It has gotten me to the point of almost being able to release my first iPhone app!
Okay, so the last part I have is this: I have a game that allows users to save their high scores. I update a plist file which contains the users Name, Level, and score.
Now I want to create a screen that will display the top 20 high scores. What would be the best way to do this? At first I thought possibly creating an HTML file with this info but am not even sure if that is possible. I would need to read the plist file, and then write it out as HTML. Is this possible? To write a file out as HTML?
Or an even better question, is there a better way?
Thanks in advance for any and all help!
Geo...
This is what UITableView was made for. Read your plist into an array and feed the contents to the table view through its datasource/delegate methods.