Currently I am developing an application in Xcode using objective c where you can post something and view other peoples posts. It sends this post to a database, and then on another view controller that post would be shown for any user of the app to see. I know how to post and receive data from the database, however my problem is displaying the data. I would like to display an un-editable textview or something along that line for each post on the page that displays the posts. I am not sure how to create one for every time there is a new post and how to make the page scroll. I know this is a lot to ask, however if possible please help me out. If you are confused about how I am trying to display the data, you could look at edmodo's mobile app. I am trying to display the posts in that manner. Once again, thank you and please help!
Asked
Modified
10 years, 7 months ago
Viewed
102 times
Part
of PHP and Mobile Development Collectives
1 Answer
To solve your problem you need to use UITableView or UITableViewController and need to create Custom UITableViewCell as per your need to display Post.
A Custom UITableViewCell consist of UITextView and by setting its Editable property in Attribute Inspector or programmatically self.yourTextView.editable = No; you can make UITextView Non-editable.
Also check following links:
- http://www.appcoda.com/customize-table-view-cells-for-uitableview/
- http://www.appcoda.com/self-sizing-cells/
Hope this will helps.
2 Comments
Ryan Tobin
Can I use a regular view controller and add a table view onto it instead of using a table view controller? If so how would i set that up because when I link the delegate and data source to itself the app crashes
Sachin Kadam
Sure, you can use ViewController instead of TableViewController and can add TableView onto it. After adding TableView onto ViewController set ViewController as DataSource & Delegate of TableView. for that select TableView and in right side pane(Inspector pane) of Xcode select last one Connections inspector. It will show DataSource & Delegate options. now drag from DataSource to ViewController i.e yellow point in Storyboard or document outline. do same for Delegate. imgur.com/LRqQ3Xj&NeJdSEB also refer below link. appcoda.com/uitableview-tutorial-storyboard-xcode5