Adding "stretchable" images to and image selected from gallery - ios

Im trying to make an app for planning out where you want to put "shelves" on a wall (sounds strange i know ;) )
i have got it so the image is picked from the UIImagePickerController then loaded in a new ViewController i also have a button at the bottom of the ViewController that i want to open a list of images to select from that once selected the user can move around then stretch the required size if they don't like, delete and once they are happy i want my second button to save the image and put it into an email ready for sending.
I have looked at a few ways but none of them seem to be "adequate" would be so grateful anyone could suggest any ways or even help me with some code, I'm very new to this and this is my first app.
Im not too sure on the code you'd need to see as none of what is written yet is relevant to this part of the app
This is a 2 part so the first is, what way do i go about it?, the second is what code?
Thanks

-(UIImage *)GetStreachableImage
{
UIImage *takephotoButtonImagenormal = [UIImage imageNamed:CHOOSE_TAKE_NORMAL_IMAGE];
UIImage *strechableButtonImageNormal1 = [takephotoButtonImagenormal stretchableImageWithLeftCapWidth:takephotoButtonImagenormal.size.width/2 topCapHeight:takephotoButtonImagenormal.size.height/2];
takephotoButtonImagenormal=nil;
return strechableButtonImageNormal1;
}
try this

Related

iOS Swift 4 before loading content

I build chat app using Firebase API right now. I wan't to make preload icons like on facebook screenshot. I thought i can create empty images and label fields and fill them after content loaded, but i don't know how to check if all data loaded from DB. How i can do that in correct way?
This is where i want to place objects
Install ListPlaceholder this lib.
import ListPlaceholder
To show the loader, start showing this from start
tableView.showLoader()
To hide the loader, end showing after data has been loaded
tableView.hideLoader()
Please refer this may get help.
https://github.com/malkouz/ListPlaceholder
Facebook has it's own library called Shimmer. To use this on tableview, you can follow this StackOverflow question answer.
You'll just have to create the UIView you want to animate and above that you'll have to add your FBShimmeringView. At the end set shimmeringView.shimmering = true to start shimmering
To hide the loading use tableView.hideLoader()
ListPlaceholder helped me to resolve the issue. All that I did was added the ListLoader.swift file to my project and added tableView.reloadData(), tableView.showLoader() in viewDidAppear in the tableView where I wanted to show loading.
( ListLoader.swif uses visibleCells to determine the number of rows on which the loading should be shown. In my applications, visibleCell's count was incorrect on calling tableView.showLoader() method in viewDidLoad )

Make background image change based on time of day (Local time)

Im making an app using Xcode5 and i want to have the background image (or Image View) of one of my View Controllers change between a set of images based on the local time
pretty much have a certain image show between
0600am - 1159am image1
1200pm - 1759pm image2
1800pm - 2359pm image3
0000am - 0559am image4.
Its my first time coding and i cant find anything on this matter so if someone can help me or walk me through it I would really appreciate it!
Thanks
Use something like this: How to Check if an NSDate occurs between two other NSDates to check your date ranges then call a method based on the results to change your background image to the correct one. Post some code if you are having trouble.

Best practices for managing facebook friends pics in iOS App

i'm working on an iOS app which has a tableview containing facebook friends' list, I want to manage this list for scrolling performance.
i don't want to load the images each time user open that friend list view, and for that images can be saved locally but at the same time it would not be a good practice as users can change their profile pictures after we already saved older ones to file system.
So i just wondering what is the best way to manage this?
Also how can i get those images in best possible optimized size?
thanks in advance
You might be able to use setImageWithURL:placeholderImage: in the UIImageView class in AFNetworking to load a placeholder (or existing image) and then request the latest image which will get updated when fetched.
The docs are here:
http://afnetworking.org/Documentation/Categories/UIImageView+AFNetworking.html
The project is here:
https://github.com/AFNetworking/AFNetworking/
UIImageView should take care of resizing the images.
Well if you want to set placeholder image it is possible. The FBProfilePictureView is a UIView but if take a look into the code you'll see that they add UIImageView to it. That's why you can use:
for (UIView *view in cell.faceImageView.subviews) {
if ([view isKindOfClass:[UIImageView class]]) {
[(UIImageView*)view setImage:[UIImage imageNamed:#"placeholder"]];
break;
}
}
Ofc, that's a workaround. However until they provide better thing you don't have to mess here with AFNetworking(which is a great lib btw) and finding facebook image url ;).

Change image of three20 TTTableImageItem programmatically

i am using a TTTableViewController (three20 framework) for displaying user profile data (username, user image, etc.).
The tableview datasource is set up as follows:
_profileImageItem = [TTTableImageItem itemWithText:#"Change Profile Image" imageURL:DEFAULT_PROFILE_IMG URL:#"tt://photoThumbs"];
self.dataSource = [TTSectionedDataSource dataSourceWithObjects:
#"Profile Image",
_profileImageItem,
#"Profile Name",
_profileName,
...,
...];
When the user tabs the _profileImageItem, a UIImagePicker view is presented where the user can select a new image. After that i scale the image down and write it to the apps document folder.
My problem now is: How can i update the image URL in the datasource? Currently it still points to DEFAULT_PROFILE_IMG. Even when i update the _profileImageItem member using:
[_profileImageItem setImageURL:#"new URL here"];
the old image is shown. I have tried refreshing the view - same problem.
Any help is much appreciated.
Ok i made a stupid mistake.
TTURLCache was enabled and i updated only the image, not the path (i.e. i have overwritten the profile image). As the path is used as a key in the TTURLCache, the cache returned the cached image ;)
[[TTURLCache sharedCache] setDisableImageCache:YES];
solves the issue.

How to call LazyTableImages in my own project

I am new to IOS development, and I would like to use the LazyTableImages sample in my project. I have main screen displaying a list of menus. What i want to achieve is that when a user clicks a menu on the main screen, it will start a new screen which calls the LazyTableImages code and downloads the images.
But i have no idea how to do that.Because in the sample, the screen with the images is the first window, and in my project, it is not.It seems that I will need to move the LazyTableAppDelegate.h and LazyTableAppDelegate.m to the my own delegate file AppDelegate.h and AppDelegate.m files but i didnt get any luck doing that. Can anyone shed any light how should i make the change? Is there any sample code i can refer how to call one project in the other?
http://developer.apple.com/library/ios/#samplecode/LazyTableImages/Introduction/Intro.html
this links solve your problems.
1) [HJCache][1]
2) [Video Part1][2]
3) [Video Part2][3]

Resources