I would like to get some advice. I am in the process of making an application where ideally a user can scan through a list of places, see some detail about the place (like name, perhaps some pictures) and be able to select the places they want and save it on a map.
For this I wanted to use Google API. I have created a tabbed application and in one tab I have the GoogleMaps and in another TableView which follows through onto a DetailTableView. My question is firstly, is it possible to link between tabs where upon selection of a cell by the user in Tableview would automatically map the place onto the GoogleMaps tab? Secondly, is there any advice about how to approach this? And how this type of database should be stored/structured? It would have to be a database which will allow access to be updated as well as the user to contribute perhaps.
In the initial table view I would probably just want the name of places whereas the Detailed table view should give more details such as Address, website link (if place is a business), opening times, related pictures etc...
I think you're better off checking Place Autocomplete as it deals with names of places and some details about them. It also has sample codes on displaying Table Views.
If you want additional code samples, check out Layering a table view and a google map view iOS Swift and Picker Places from Google Maps to UITableView.
Related
I am very new to swift and currently making an app for a school project. The app is supposed to show a collection of recipes. I have begun by having a scrolling grid of buttons (stackviews and scrollviews). Each recipe is supposed to connect to a specific recipe, and when clicked segue to a view that has the information for the recipe (image, ingredients, instructions, etc.). I would like to do this by creating a a basic recipe view file that has a space for an image, title, and text. Then, depending on what button was pressed, fill in the view with the correct information and display the view.
I have figured out an alternative method that I could use, but it is very bulky and tedious. I could set up views for the ~25 different recipes separately, and link them individually to each button.
I would much rather prefer the first option, but I am not quite sure if it is even possible, or if I am just really bad at using the right search terms in google. I know many other apps have similar systems set up, for example a social media profile is the same template for everyone, just has different data displayed inside of it.
Can anyone help me out? Thanks in advance.
You can use UITableView for this task and have a model array that you fill with the required data ,and for action use didSelectRowAt to find which cell is clicked send the data to the next VC
This is my first post about Swift and I hope someone can help me. I'm a junior Ruby/Rails developer and have recently started building an app for a personal project to get to grips with developing in Swift and XCode, as it is something I am interested in moving into.
I have just started building my app, but have hit a problem almost straight away that I have been unable to find a clear answer to or any guidelines that I can bend to serve my purpose. I'm sure it must be a fairly simple issue to solve, so I'll try and write my problem as clearly as possible:
If I want to take some user input from a text field, such as a name or a location, and then display that input in another view controller, how would I go about doing it?
So far in my app, a user is presented with a button, which when pressed, shows a view controller with two text fields. I want to take the input strings from the two text fields and display that data in a label on the next view controller, so the user can add more information to the object before publishing it to be displayed in a table view cell elsewhere in the app. I have used IBOutlets on the text fields.
I have been reading about Core Data in Swift and have worked through a couple of tutorials about adding data to a table view, including the Start Developing iOS Apps (Swift) from Apple and I think I'm on the right track to finding out how to achieving the functionality I want. But I'm not entirely sure, and wanted to ask if I am on the right path or if I'm going about it the wrong way?
If anyone could link me to any tutorials or guides or point me in the right direction so that I can figure out what seems like a basic step of storing data that can be retrieved and displayed in other view controllers, I would appreciate it very much.
Thank you in advance.
You may do it by many ways -
If you want to take input string to the immediate next UIViewController, then when you navigate to another UIViewController , initialise two string object of that view from current UIViewController and then navigate. In that UIViewController you can have your string.
If you want to use those strings in some other UIViewController then you can take two string variable in AppDelegate(That is a global class) and set them from current UIViewController and you can use them whenever you want.
If you want to permanent save that data then you can better use NSUserDefaults ( NSUserDefaults - storing and retrieving data )if it is only 2 or 3 or some little amount of field data. If data is more you can use database.
Try these links :
http://jamesleist.com/ios-swift-passing-data-between-viewcontrollers/
How do you share data between view controllers and other objects in Swift?
http://blog.apoorvmote.com/how-to-pass-data-via-multiple-segue/
So I want users to be able to enter a search query, and should it return an empty or non-empty result the appropriate view is displayed (shown below):
As I'm fairly new to iOS I thought about the following possible ways of implementing this. I'm not sure if any one of these is deemed as good practice or maybe another better solution exists:
Create two separate view controllers with their own views that will display a message for empty search results or show non-empty results respectively
Create a single view that will house all of the components and show/hide certain components based on whether or not the results are empty/non-empty
Create a single view, but programmatically implement the methods for drawing the relevant components and just initialise the VC with the respective designated initializer (one for empty and the other for non-empty results)
The best practice is to manage the empty state of tableview meaning have a single tableview and display data when available, if no data is available display a friendly message in the tableview itself.
Below is the link that will help you implement the code:
http://www.ryanwright.me/cookbook/ios/objc/uitableview/empy-table-message
There are ots of examples available on net for managing the empty state of tableview.
What I basically want is to show the user's name in the first tableView but have a disclosure indicator (segue) to go to a second tableView which will show the history of the selected user. I know how to load data into a table and how to segue from one row to the detail table but I just don't know how to show different data for each user. I know this may be out of my scope of knowledge at the moment but I would like to give it a try.
1- What would be the best way to store the data for each user (history), an array per user?
2- How can I relate data to a specific user so it loads when the user's name is touched?
3- How can I capture the row being selected?
Any suggestions will be appreciated.
Honestly, you shouldn't worry about it being outside of your scope of knowledge, as that's how people learn. You will need to do some amount of work, however, and that part can be a little difficult.
Luckily, what you're trying to do is a very well documented function and Xcode even provides a template for master -> detail views.
Check out this wonderful tutorial by Ray Wenderlich on creating a simple master-detail application: http://www.raywenderlich.com/1797/ios-tutorial-how-to-create-a-simple-iphone-app-part-1
His other tutorials will also be immensely helpful to beginning iOS development: http://www.raywenderlich.com/tutorials
I have been following many examples to add addressbook functionality to one of my views.
I am getting stumbled between Addressbook API, ABPeoplePickerNavigationController and how to fit them into UITableView. I am highly confused as to what all controls I need to put over my storyboard to get the whole thing working.
What I need is:
Last Name First Name (in table view display) along with an image icon (same for all contacts)
Phone Number (needed but not necessarily to be displayed)
When single cell is clicked, it should present a popover that offers certain number of options in a popup menu (but contacts table view should not disappear with the popover)
Can anyone point me exact example that achieves this?
XCode steps that can optionally achieve would also be highly appreciated.
I believe you are a little confused with how the AddressBook API works.
There's an apple developer reference that have a good example of how you can use the API.
I have linked it here Apple QuickContact Reference
In summary, you can preload certain data that you are keen to display on your tableview into NSArray. Then upon UITableView's didSelectRowAtIndexPath call the respective method to push the another viewcontroller to display.
Hope that clears up your doubt.