share photo from Camera Roll via my app - iphone

i want to develop a app that can share image to social network, it work well but i want my app have some advance function
i see that in ios6, it can share image from photo library by tap sharing button
now i want my app in the list app in share screen, how can i do that ?
- (void) loadMoreData
{
[self requestServerGetTimeline];
}
- (void) btnImageClicked:(NSString *)photoId
{
DetailImageController *detailImageController = [[DetailImageController alloc] initwithPhotoId:photoId withNavigationController:self.navigationController];
[self.navigationController pushViewController:detailImageController animated:YES];
[detailImageController release];
}
- (void) btnUsernameClicked:(NSString *)userId
{
MeshUserInformationController *detailUserController = [[MeshUserInformationController alloc] initWithNavigation:self.navigationController withUserId:userId];
[self.navigationController pushViewController:detailUserController animated:YES];
[detailUserController release];
}

You can't configure UIActivityView controller of Photos app but you can configure and make your own activities for your apps.

Related

iOS: Launch AppStore page within my App

I seen games like
Kingdom Clash
Castle Story
being able to launch AppStore within their game without minimizing their game.
The AppStore page will just slide in from bottom, show a game page, and players can download that game, key in their password, close the page and they are still in the game.
Is there a way to do this?
I can only minimize my own app, and open the Appstore.
Please advise.
Thanks
You can use SKStoreProductViewController class
Import StoreKit framework
#import <StoreKit/StoreKit.h>
Implement the SKStoreProductViewControllerDelegate
#interface MyViewControllerClass : NSObject <SKStoreProductViewControllerDelegate> {
}
- (void) openAppStore
{
if( NSStringFromClass([SKStoreProductViewController class]) != nil )
{
SKStoreProductViewController *viewCont = [[SKStoreProductViewController alloc] init];
viewCont.delegate = self;
[viewCont loadProductWithParameters:[NSDictionary dictionaryWithObject:#"APP_ID_FROM_ITUNES" forKey:SKStoreProductParameterITunesItemIdentifier] completionBlock:nil];
[self.navigationController presentViewController:viewCont animated:YES completion:nil];
}
else
{
// open safari
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://itunes.apple.com/us/app/facebook/id284882215?mt=8"]];
}
}
// SKStoreProductViewControllerDelegate
-(void)productViewControllerDidFinish:(SKStoreProductViewController *)productViewController
{
[productViewController dismissViewControllerAnimated:YES completion:nil];
}

Taking photos using the Iphone camera

We have developed an iPhone app and now wish to utlise the camera to:-
- take a photograph and save it in a specific sub-directory (set up when the App is upgraded/loaded) of Photos but only when the photo is taken from within the app. All other photos should go to the standard photo folder. Is this possible and how can we do it?
- We would like to reference these photos so that pressing a link within the app history accesses that specific photo. Other photos are referenced elsewhere in the app history. Again is this possible and how can we do it?
- (IBAction) buttonname
{
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)UIPicker didFinishPickingImage:(UIImage *)info editingInfo:(NSDictionary *)dictionary
{
[UIPicker dismissModalViewControllerAnimated:YES];
imageview.image=info;
}

How to access camera of iPhone using phonegap app

I have a simple application developed for android which takes a photo, accessing the camera of device.
I want the same application to be run on iPhone. For android we write permissions for accessing camera in manifest file. How do you access the camera in iPhone. Where do we need to set up it. Can anyone please help me?
Thanks in advance
Use the Media Capture API in the latest code, or wait for 0.9.6:
http://docs.phonegap.com/phonegap_media_capture_capture.md.html
For accessing the camera in iPhone, you can use following code.
// Camera
UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
imgPicker.delegate = self;
imgPicker.allowsImageEditing = YES;
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
//[self presentModalViewController:imgPicker animated:YES];
[objParent presentModalViewController:imgPicker animated:YES];
[imgPicker release];
Let me know in case of any difficulty.
Below are the delegate method for camera.
Delegate Name: UIImagePickerControllerDelegate, UINavigationControllerDelegate
Methods:
#pragma mark UIImagePickerController delegate
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *imgCapturePhoto = [info objectForKey:#"UIImagePickerControllerOriginalImage"];
[imgPhoto setImage:imgCapturePhoto];
[self dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *) picker
{
[picker dismissModalViewControllerAnimated:YES];
}
Cheers

How to run iphone GameCenter app from my app?

I think the best way and may be only way is using the URL schemes with [[UIApplication sharedApplication] openURL:...]. But I can't find URL scheme for game center..
You can launch the Game Center app by using the gamecenter: URL scheme:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:"]];
In iOS 6.0 there's a new way quite cool to show Game Center using GKGameCenterViewController.
For using it your view controller must acts as a delegate to the GKGameCenterViewController:
#interface ViewController : UIViewController <GKGameCenterControllerDelegate>
And then for displaying the Game Center view:
- (void)showGameCenter
{
GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc] init];
if (gameCenterController != nil)
{
gameCenterController.gameCenterDelegate = self;
[self presentViewController: gameCenterController animated: YES completion:nil];
}
}
//Called when the player is done interacting with the GKGameCenterViewController
- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController
{
[self dismissViewControllerAnimated:YES completion:nil];
}
If the user it's under iOS 5.0, you can only use the URL schemes like you said before.
Try the Apple example code. It explain how your app work with gamecenter. http://developer.apple.com/library/ios/#samplecode/GKTapper/Introduction/Intro.html

iPhone SDK - WebView activity indicator

I have a big problem with the UIWebView in iPhone SDK.
I have a TabBarApplication with one WebView on each Tab (except the first).
Because it takes quiet a while to load the views I'd like to show an activity indicator.
Here is the code I'm using in order to do that:
-(void)webViewDidStartLoad:(UIWebView *) portal {
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
-(void)webViewDidFinishLoad:(UIWebView *) portal{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
It doesn't work this way... My WebView in the first tab is called "portal", that's why I entered it above, but the same problem exists if I use WebView.
Any ideas? Can't be true that this is soooo difficult.
I'm searching for a clue quiete a while now and found nothing which helped me to build such a (think it's easy) activityindicator.
Thanks a lot for your effort!
Greets from Germany
Tobias
I typically use a UIActivityIndicatorView.
If you have a Navigation Controller on top of the web view it works perfectly:
-(void)webViewDidStartLoad:(UIWebView *) portal {
UIActivityIndicatorView *actInd = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
UIBarButtonItem *actItem = [[UIBarButtonItem alloc] initWithCustomView:actInd];
self.navigationItem.rightBarButtonItem = actItem;
[actInd startAnimating];
[actInd release];
[actItem release];
}
To get rid of the indicator:
-(void)webViewDidFinishLoad:(UIWebView *) portal{
self.navigationItem.rightBarButtonItem = nil;
}
If you aren't using a Navigation Controller then I would simply use either the larger style, UIActivityIndicatorViewStyleWhiteLarge OR place the view on top of a dark semi-transparent view on the screen and then remove them on load finish.