EGOPhotoViewer: Start at specific photo - iphone

I am using EGOPhotoViewer to load up a bunch of images from the web. They are shown in thumbnails first, so when a user clicks on one of the thumbs, I want to show that image in the EGOPhotoViewer first. So, if I clicked the 5th image, it would load the image viewer starting at 5 of 20 or whatever.
Is there a way to do this?
ZSPhoto *photo;
for (Asset *a in items) {
photo = [[ZSPhoto alloc] initWithImageURL:[NSURL URLWithString:a.imgURL] name:a.caption];
[photos addObject:photo];
[photo release];
}
// Photosource
ZSPhotoSource *photoSource = [[ZSPhotoSource alloc] initWithPhotos:[NSArray arrayWithArray:photos]];
EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithPhotoSource:photoSource];
// Set starting photo index here?
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:photoController];
navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
navController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:navController animated:YES];
[navController release];
[photoController release];

I was running into the same problem, What I was doing was trying to moveToPhotoAtIndex: before pushing it to the navigationController. You need to do it after.
here is how i got it to work for my application...
// gets indexPath from tableView
-(void)showSelectedPhoto:(NSIndexPath *)indexPath{
// Already had photoControllerView declared in header, init with your photo source
photoControllerView = [[EGOPhotoViewController alloc] initWithPhotoSource:source];
// pushed the photoControllerView to the navigation controller
[self.navigationController pushViewController:photoController animated:YES];
// THEN you moveToPhotoAtIndex and it should work correctly!
[photoController moveToPhotoAtIndex:indexPath.row animated:NO];
}
Hope this helps clarify things!

There is a method moveToPhotoAtIndex:animated: that you should be able to use.

i am using same process to load the images in image viewer. and app is working fine for me..you can get the code from here
selected image wouldnt load in ego image viewer in ios 7
hope you will get help.

Related

add eventViewController not showing anything

I'm currently working on a agenda part of an app. I managed to show all my events and also go to the details from it and edit it. But when I want to add an event it shows me an empty view. I should mention that I have a custom datasource for my calendar.
To edit an Event I just do this in my ViewController.
EKEventViewController *vc = [[EKEventViewController alloc] init];
vc.event = [dataSource eventAtIndexPath:indexPath];
vc.allowsEditing = YES;
[calendar.navigationController pushViewController:vc animated:YES];
This is showing me the correct VC with the correct event.
Now this is my code for adding a event.
EKEventEditViewController *addController = [[EKEventEditViewController alloc]init];
// set the addController's event store to the current event store.
addController.eventStore = self.eventStore;
addController.editing = YES;
// present EventsAddViewController as a modal view controller
[self presentModalViewController:addController animated:YES];
addController.editViewDelegate = dataSource;
But when I run it I get an empty viewController. Can anybody help me with this?
Kind regards.
I'm guessing that you didn't create the event store. I looked at Apple's demo program, and I could eliminate all but 4 lines, and still get that edit controller to show up:
#import <EventKitUI/EventKitUI.h>
#implementation ViewController
-(IBAction)doStuff:(id)sender {
EKEventEditViewController *addController = [[EKEventEditViewController alloc]init];
addController.eventStore = [[EKEventStore alloc] init];
[self presentViewController:addController animated:YES completion:nil];
}

how to use EGOPhotoViewer in iPhone app?

i want to use EGOphotoviewer in my app such like that when user press button, instead of loading tableView of rootviewController, it just navigate to photos, can anyone help me ?
here i don t want tableView i just need a button for photos
The demo project is using a UITableViewController subclass called rootViewController and on the didSelect method it is just initializing the EGOPhotoViewerController and pushing it. All you need to do is instead of using a UTableViewController subclass, use a UIViewController subclass, add a button inside its view, create an action for that button, and inside the action, do the exact same thing ::
MyPhoto *photo = [[MyPhoto alloc] initWithImageURL:[NSURL URLWithString:#"http://a3.twimg.com/profile_images/66601193/cactus.jpg"] name:#" laksd;lkas;dlkaslkd ;a"];
MyPhoto *photo2 = [[MyPhoto alloc] initWithImageURL:[NSURL URLWithString:#"https://s3.amazonaws.com/twitter_production/profile_images/425948730/DF-Star-Logo.png"] name:#"lskdjf lksjdhfk jsdfh ksjdhf sjdhf ksjdhf ksdjfh ksdjh skdjfh skdfjh "];
MyPhotoSource *source = [[MyPhotoSource alloc] initWithPhotos:[NSArray arrayWithObjects:photo, photo2, photo, photo2, photo, photo2, photo, photo2, nil]];
EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithPhotoSource:source];
[self.navigationController pushViewController:photoController animated:YES];
[photoController release];
[photo release];
[photo2 release];
[source release];
And you'll get what you want.
Hope this helps

FGallery does not begin in thumbnail view

What am I doing wrong? FGallery is not starting in thumbnail view?
FotosGalleryViewController *vc = [[FotosGalleryViewController alloc] initWithPhotoSource:self];
vc.beginsInThumbnailView = YES;
[self.navigationController pushViewController:vc animated:YES];
When I turn showThumbnailViewWithAnimation:BOOL into a public method and call:
[self showThumbnailViewWithAnimation:YES];
within the FGalleryViewController it works. But it only loads the first two images in thumbnail view, the rest stays gray. Clicking Close and See all again fixes this and everything works as promised?

iPhone SDK - Changing Xib files (partial curl)

I am creating an iPhone app for iOS 4 using the newest SDK.
On one of my pages I would like the user to click a thumbnail of a photo and then a partial curl transition style take affect to show a full sized version of the image.
On the page with the full sized image I have a toolbar with a "Back" button and a "Select" button.
When I click the Back button the partial curls rolls back down to my first Xib.
BUT when I click the Select button, the app crashes.
Can anyone help me or explain why it is doing this? Thanks!
.m file:
-(IBAction)switchViews4 {
ImagePicker *image = [[ImagePicker alloc] initWithNibName:nil bundle:nil];
image.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:image animated:YES];
[image release];
}
Without seeing any other code, it is difficult to know why. But one guess is that you have a reference counting problem. Try:
-(IBAction)switchViews4 {
ImagePicker *image = [[[ImagePicker alloc] initWithNibName:nil bundle:nil] autorelease];
image.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:image animated:YES];
}
and see if it helps.

iphone presentModalViewController

I have an app, inside that an UIViewController is attached on the UIWindow.
on the view of UIViewController, i have added a button and a uiview_1 of size 100x80.
this uiview_1 contains another uiview_2 as subview of same size and this uiview_2 contains a UIImageView or a UIlable at runtime (both UIImageView and UIlable are userinteraction enabled)
now on the touch/click of UIImageView, i want to show a new view using presentModalViewController, the problem is the view is shown and using back button on the navigation bar i come to the previous/main screen.
here the problem come in picture, now i am unable to touch the button or the UIImageView.
both are not responding, but app is not crashed and nor frozen.
what is wrong in that?
Plz help in this...
----- EDIT:
Approach First:
SWVController *swvController = [[SWVController alloc] init];
UINavigationController *viewNavController = [[UINavigationController alloc] initWithRootViewController:swvController];
UIViewController *pushController = [[UIViewController alloc] init];
UIWindow *win = [[UIApplication sharedApplication] keyWindow];
[win addSubview:pushController.view];
[pushController presentModalViewController:viewNavController animated:YES];
In the swvController i have back button that calls the dismissModelViewController on click >> result is the Main screen ctrls are not responding to touch – sandy 3 hours ago
Second approach:
SWVController *swvController = [[SWVController alloc] init];
UINavigationController *viewNavController = [[UINavigationController alloc] initWithRootViewController:swvController];
UIViewController *pushController = [[UIViewController alloc] init];
[self addSubview:pushController.view];
[pushController presentModalViewController:viewNavController animated:YES];
In the swvController i have back button that calls the dismissModelViewController on click >> result is the swvController's back button on navbar is not responding – sandy 3 hours ago
3rd approach:
SWVController *swvController = [[SWVController alloc] init];
UINavigationController *viewNavController = [[UINavigationController alloc] initWithRootViewController:swvController];
SampleAppAppDelegate *appdel = [[UIApplication sharedApplication] delegate]; [appdel.viewController presentModalViewController:viewNavController animated:YES];
>> result is working fine, but the problem is i dont want to use SampleAppAppDelegate,i want to give my small Uiview (100x80) as a ctrl to other person , where my ctrl will not able to get the AppDelegate of thet app at run time. – sandy 3 hours ago
Call this method when you want to present the modal view controller:
- (IBAction)showInfo {
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:#"FlipsideView" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
}
Add this method to your self:
- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller {
[self dismissModalViewControllerAnimated:YES];
}
Use a toolbar or other button and connect it to this method in your modal view controller:
- (IBAction)done {
[self.delegate flipsideViewControllerDidFinish:self];
}
All code comes from Apple.
How did you handled click/touch on UIImageView? TouchesBegan/Ended?
Try putting some logs (NSLog) and run your app in debug mode (put some breakpoints) to see if control reaches your action method...
Also, when you do presentModalViewController, you do not need to POP out with back button on navigation bar... you only need to dismissModelViewController to hide it.