Integrating EgoImageLoader by using UIImageView instead of egoimageview - objective-c

I'm new to objective c. Want to implement EGOIMAGELOADER for my customised tableview, but as i have mutliple uiimageview and that has to be in their respective fix position so i have created uitablecell in xib and placed the uiimageview in the alignment i want it.
I went through the ego example but there the egoimageview is being used to create imageview dynamically.
I want to use my uiimageview with egoimageloader and not use egoimageview as i have fixed placement of imageviews in uitablecell.
I want to implement lazyloading and caching of images using egoimageview.
Can anyone help me with example or sample code to achieve above requirement.
As i'm using normal code for loading images in uiimageview for tablecell. So don't know what to include for code snippet.

Related

Add custom UIView in UINavigationbar's title view

I want to add custom UIView in UINavigation's titleview. The problem is, the width of my custom view is 320 and it don't auto fit in UINavigation's titleview. Some portion of my view gets out from the r.h.s boundary.
In following image, bottom view show the whole length of custom view, this is just for description purpose here. Actual situation is little different. I am designing in xib files. UIView is designed in different file and used in some UIViewController by programatically like self.previousNavTitle = self.customView;
But I am getting some portion of custom view hidden. Please guide me in this regard. Thanks.
Try below code snippet
self.navigationController.navigationBar.topItem.titleView = self.customView;

Proper way to build custom UITableViewCell

I've been wondering about UITableView's and their cells for a while. UITableView is a very handy UIView subclass, but there is a lot of predetermined/forced content on a UITableViewCell. I was wondering what is the best way to create a custom UIView (which will end up being a UITableViewCell) for UITableView?
The cell has a certain style that has to be set and there are predetermined UILabels and accessory views that are completely immutable, other than their contents. I find this to be a big waste, but just giving the cell a custom content view (and background view, if one pleases) doesn't prevent or remove these processes or restore the memory.
Is there any way to create a lighter version of a UITableViewCell subclass? Or is there a way to use a UIView with a selection method instead (other than essentially creating a custom UITableView using UIScrollView)?
Any suggestions would be really appreciated.
There are a few methods:
From a XIB file:
ios steps to create custom UITableViewCell with xib file
http://www.icodeblog.com/2009/05/24/custom-uitableviewcell-using-interface-builder/
Using Drawing:
http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html
http://developer.apple.com/library/ios/#samplecode/TableViewSuite/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007318 (4th and 5th examples)
There doesn't seem to be an answer for this. UITableViewCells will always have UILabels and other views automatically added to them. I'm not sure if they are allocated before you set them, though. They may have custom setting / allocation methods.

How does UIBarButtonItem know which UIBarStyle the UIToolBar uses?

In Xcode ui builder when one set the UIBarStyle of the UIToolBar (such as BlackTranslucent, for example), the UIToolBarItem matches the background images to it. How does the UIToolBarItem know which style it should use?
I'm trying to do a put a custom colored image on top of the regular background tile (programatically merge a given image on top of the background image). I want to the code to be generalizable enough so that it is able to handle all UIBarStyles. That means I want to know when UIToolBarItem decides which background to use and intercept it so I can compose the button image on the fly.
Without being able to see apple's implementation of UIBarbuttonItem, I posit that they do not, in fact, know what the style of their UIToolbar is. If you look closely, they have the same alpha as their toolbar, and the same overlay (indicative of a subview). Therefore, any image that is below this highlighted layer, added as a subview, should conform to the UIToolbar's style. If you want to use multiple images though (one for each barStyle), you can determine it with self.myToolbar.barStyle and plan appropriately at -viewDidLoad time. As for true image drawing, subclass UIToolbar and override -drawRect: and use [UIImage drawInRect:rect];

Best way to implement "iOS Photos style" tiled image gallery

I have an app that basically can be used to download, upload, and manage photos from various web services.
I want the image list view to look like the iOS Photos app but not quite sure what the best way to do that is.
I was thinking I could use NSMutableArray and subclass UIScrollView to create that functionality from scratch but I'd really like to use NSFetchedResultsController because some of the data related to the images are dynamically/asynchronously updated/inserted/deleted in Core Data.
Right now I've setup something pretty hacky.
I created an separate Core Data entity to hold relationships to 4 photos in each managed object and I made UITableView loop through them. Then cellforrow delegate would loop through the 4 photos in each table cell. This approach sucks because it's hard to delete and insert photos dynamically and I have to reconstruct relationships and reload the table each time an update is made.
I've looked at some other libraries that do this but I really want to understand what the most simple and efficient way to do this is.
If you are referring to the tile view, you can duplicate that using a UITableView or a UIScrollView. If you want it to side scroll then a UIScrollView is the starting point.
If you want it to scroll vertically (which I recommend on iPhone) then use a UITableView with a custom UITableViewCell.
As for the Core Data side, you are probably coming at this incorrect, you are trying to store UI state information (how many photos are in a cell) in core data. Core Data should not care about how many images are in a cell.
UITableViewCell
To use a UITableView you would create an array that contains all of your images. You can then determine how many rows you need by dividing that array by the number of images per row.
From there you should subclass UITableViewCell and pass in the 4 images for that cell to draw. Then it is a simple matter of adding 4 UIImageView instances to the custom cell and setting the images.
UIScrollView
For a scrollview you crate a UIImageView for each image and then add them as subviews of the UIScrollView. You would then set the frame of each UIImageView so that they are displayed in a grid.
If you find you have more images than you can hold in memory at once then you will need to deal with tiling, effectively paying attention to where the user is scrolling and filling in (via moving the offscreen image views) ahead of the edge the user is scrolling towards. This is the same thing you get effectively for free with a UITableView via its queuing of cells.
I just did this with a UITableView - you are over thinking it with the relationships.
For my solution I created a UITableViewCell subclass has four buttons as properties.
In my cellForRow method I figure out which four images belong to that row and then set the appropriate image for the appropriate button.
My images are in an array in my view controller. I populate the array in viewDidLoad. Whenever I add or delete an image from the managedObjectContext I repopulate the array and then reload the tableview. Reloading the tableview will rearrange the images in the cell appropriately.
Scrolling is smooth and the only drawback I have run into is that I would like the images to animate to their new positions when I delete one, but I do not think that I'll be able to pull that off with this setup.
I think a very nice implementation is AQGridView.
It is easy to extends, has nice reordering (see the springboard demo) and it reuses the cell.
If you ever implemented a TableViewDelegate, you should be able to use it.
You should check out the Three20 photo viewer. The project is on github. Also, there's a nice tutorial for the photo viewer here

How to write UIView to a projector?

How do I write a UIView to a projector that can work off the iPhone?
You can use the UIScreen class to present content on an external display (including a projector). You'll need to create a new UIWindow. Here is some relevant sample code from Apple as well.