I'm developing an RSS Reader and I need to get the favicon for each feed. For example, if my feed is google.com, I'd like to get the "G" icon and put it into a UIImage or something. Any ideas on how to achieve this?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
If you save the image to your desktop,
1) drag image into xcode 2)Go to interface builder 3)Go to the identity inspector after selecting the UIImage 4)Under the
image
drop down box, select the name of your image.Hope that helps!
If you want the favicon, try calling this URL:
http://www.google.com/s2/favicons?domain=<rss_domain>
from within your app:Otherwise, an RSS channel's metadata has an optional element,
<image>
, which is described here: http://www.rssboard.org/rss-specification#ltimagegtSubelementOfLtchannelgtFor example:
This image will typically be larger than a site's favicon, and likely not-square, but with some clever cropping and scaling, it can work as an icon if a feed's favicon isn't available.
The easiest way to go would be to use Google:
That should work.
You would just have to replace the domain where you want to query your icon.