adding images to table view swift - ios

storyboard
uiimageview extension to load image
Cell class
cell loading in tableview
Ive been trying to add images to my table view using these functions but for some reason the images wont show up it doesnt throw any errors and the url s are being passed in correctly since the print shows urls. Any help on why these photos wont show up would be massively appreciated

Your code snippets are correct. I think the only problem is that your UIImageView (userImage) is not constrained on the view in the Storyboard so it disappears every time the App is run.
What you need to do is Add New Constraints by typing the values:

Related

UIImageView Not Deleting From UITableView

I have created a UITableView with a cell inside. Inside this cell view, we have a Content View, and in that, I have subtitle text. This is all in the storyboard. I wanted to have an image right next to the cell, so I put an image and chose a picture.
The image turned out really small, and I couldn't even make it bigger - it was that small. So I put another image view that I created in the view and plopped it into the tableView. Then I try to delete the first tiny image view. It doesn't delete.
When I try to move it out of the Content View, it duplicates itself. When I try to drag it to the view and out of the Content View, it sends a duplicate version. So I tried to change the cell type from subtitle to custom, hoping that everything in the Content View would disappear and I can put it in again.
Then, Xcode crashed. I tried again with changing it to custom, but it crashed again. I didn't put the crash report because it is very long but tell me in the comments if I should put it, and I will edit this question to put it in. Tell me if there is any other information you need.
Thank you in advance!
UPDATE:
I deleted the whole cell. I realized that when putting a picture in the attributes inspector of the table view cell, it makes the picture either really big or really small. It doesn't allow me to resize the picture or move the picture without randomly duplicating it. Does someone know why this happens?
If you want to customise the size of your image, you can do so very easily by creating a UINIB file and then customising the look of your cell in the new file created. You can do so by creating a new cocoa touch class of type UITableViewCell and then select the create XIB file checkbox. Then you will see a similar to main.storyboard layout which works exactly like the main.storyboard and the difference is that it is specifically for the table cell. Make sure you register the UINIB with the table view so that you can control the data that shows up in your cell. I hope this helped!

Can't figure out what am I doing wrong with loading custom view from .xib

in my ViewController and Main storyboard
I'm trying to load a custom view (LogView) programmatically from .xib.
when the "Next" button is pressed a text supposed to appear in the custom sub view (myView). the "DidReceiveJSON" method suppose to load the custom view.
This is how my LogView looks like and the "Display" method suppose to update the "myLog" UIlabel.
EveryThing was working when "MyLog" view only contained a UIView and a UILabel. but I wanted to add a UIScrollView because the label grows every time "Next" button is pressed.
So now when I press the "Next" button nothing is happening in the simulator.
could you please help me figure out what I'm doing wrong?
sorry for not uploading images, but I'm not allowed to upload any images due to my low rank. I did uploaded links to the images and will gladly add any info if needed
Please check if you have connected outlet of MyLog UILabel with File's Owner in the xib. Check if the label is nil or not.

Swift Custom TableViewCells only appearing in stack view

I have a simple TableView with a custom cell that has two labels and an image. Everything is linked correctly between my custom cell class and the storyboard itself, but when things run on the simulator it just doesn't show up. Eventually I put them in a stack view just because, and it turned out to work. This makes no sense to me as why would a stack view make something appear but without it they don't even appear as the wrong size. Here are two pictures showing the cell with and without the stack view and what it looks like when executed.
Before
After
Not sure what the problem is or how to fix it.
The layout for my project is width-Any and height-Regular

Putting a UIImageView into table cell for an RSS feed app

I need to create an app for my internship, its an rss feed reader app for a news site that I've been working on for far too long since im trying my best to learn and I need to show something to them soon. I have never made an app in my life and I was allowed to use some free open source code. I found one in swift that is just along the lines of what I need and i put in the rss feed link and it worked. The only thing is, the app doesn't have a thumbnail view preview of the articles picture on the left hand side of the articles cell in the table view navigation controller. I tried putting in a UIImageView into the cell to get it started but it wont let me do it, almost like the cell is locked with just the title and description as seen in the screenshot below:
So the table view controller in my xcode project looks something like this:
(I got that image from google but its about the same minus the fact that I have the date and time of the article under the title instead of summary)
When I try to edit the tableview cell it wont even let me put an imageview there, and when i change it to "custom" the title and summary go away. If anyone could help me to get it to look something like this with the imageview pulling the photo from the article each time it would be greatly appreciated: (Also, I can share the source code via github to view and/or download and run yourself if that would help anyone!)
Thanks
In the attribute inspector, make sure you have the Style for the UITableViewCell set to Custom.
You will need to drag in your labels as well to create your complete cell.

Custom UITableViewCell class in Xcode 4.2

I've been following this Apple Doc to add a custom UITableViewCell that I layed out in an .xib to my project. One problem with the doc is that it seems like it was written for an older version of Xcode.
I'm able to load my UITableViewController that the custom cells are on, but the cells are all blank. My custom cell contains several UILabels, and has a non-default background color. The table that appears when I run has the default white background and no labels. If I change the UITableView's View -> Background on my storyboard, the color of the cells' background changes, but the labels still don't appear.
Of interest is the fact that the data is still in my table's cells. The UITableViewController is itself called as a popover from another controller. When I select one of the cells, the strings from the various label.texts are supposed to be loaded into their own labels on the popover's delegate, and that code works fine (except when I try to include a UINavigationBar in my popover, but that's probably another issue entirely).
I'm still pretty new to iOS developement, so if there's anything I'm leaving out or being unclear about let me know.
Edit - cleaned up code, now is completely different question than when I originally posted, but is still on the same topic. Should I have deleted the old question and posted this as a new question all together, or is it alright that I just edited it?
I'm still not entirely sure what was wrong with what I was doing before, but I managed to get what I wanted. I originally dropped a UITableViewController onto my storyboard set up a popover segue (also on the storyboard) and tried to display the popover with performSegueWithIdentifier. Instead, I now create the popover completely in my code (which I found a nice tutorial for here on SO, by goggling "show popover programmaticly"), without having anything for it on my storyboard. That seems to be the most documented and stable way to show a popover. Once I displayed it that way, my custom cells showed up exactly like I wanted.

Resources