我想学习如何让用户在其他设备上拍照。
我的问题是,从下面开始,用户将idPhoto连接到iduser字段,是否可以获取发布照片的用户的deviceid并在该用户设备上异步运行snapStillImage,考虑到它是目前非常IdPhoto执行segue选择器到该照片的全屏图像?在拍摄pic之后用于全屏幕的当前方法如下。我想知道是否可以让用户拍下他们选择的其他用户的照片。我想在选择发布的照片时发生这种情况。所有发布的照片都连接到数据库中的IdUser
以及IdPhoto
。
-(void)didSelectPhoto:(PhotoView*)sender {
//photo selected - show it full screen
[self performSegueWithIdentifier:@"ShowPhoto" sender:[NSNumber numberWithInt:sender.tag]];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([@"ShowPhoto" compare: segue.identifier]==NSOrderedSame) {
StreamPhotoScreen* streamPhotoScreen = segue.destinationViewController;
streamPhotoScreen.IdPhoto = sender;
}
}
StreamPhoto屏幕,用户点击拍摄并上传的图像的jpeg拇指的当前结果,在此视图控制器中以全屏显示图片。
#import "StreamPhotoScreen.h"
#import "API.h"
@implementation StreamPhotoScreen
@synthesize IdPhoto;
-(void)viewDidLoad {
API* api = [API sharedInstance];
//load the caption of the selected photo
[api commandWithParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:@"stream", @"command", IdPhoto,@"IdPhoto", nil] onCompletion:^(NSDictionary *json) {
//show the text in the label
NSArray* list = [json objectForKey:@"result"];
NSDictionary* photo = [list objectAtIndex:0];
lblTitle.text = [photo objectForKey:@"title"];
}];
//load the big size photo
NSURL* imageURL = [api urlForImageWithId:IdPhoto isThumb:NO];
[photoView setImageWithURL: imageURL];
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
@end
帮助
答案 0 :(得分:0)
[UIDevice currentDevice]只是获取包含您所在设备属性的对象的共享实例(如单例)。该名称并不意味着暗示您可以访问其他设备(即[UIDevice someOtherDevice])。
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/