我需要能够在Instagram上分享照片以及与UIDocumentInteractionController
- Facebook,Twitter,邮件等一起呈现的所有选项。我设法与{{1}分享到Instagram },但需要在一个地方拥有所有选项。我在UIActivity
活动中添加了自定义UIActivityViewController
,但不知道如何从那里直接进入Instagram。现在它只是选择与Instagram选项类似的菜单,因为我提出UIDocumentInteractionController
。有没有办法在一个菜单上有所有选项?
答案 0 :(得分:0)
感谢:Sharing image to Whatsapp & Facebook接受了回复。
看起来这个选项实际上是为-presentOptionsMenuFromRect:inView:animated:
提供的,但我错误地呈现了控制器。显示所有选项的正确方法是使用:-presentOpenInMenuFromRect:inView:animated:
而不是UIDocumentInteractionController
UIActivityViewController
不允许省略NSString *documentDirectory=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *saveImagePath=[documentDirectory stringByAppendingPathComponent:@"MyImage.png"];
NSData *imageData=UIImagePNGRepresentation(imageToUse);
[imageData writeToFile:saveImagePath atomically:YES];
NSURL *imageURL=[NSURL fileURLWithPath:saveImagePath];
docIntController = [UIDocumentInteractionController interactionControllerWithURL:imageURL];
docIntController.delegate = self;
[docIntController presentOptionsMenuFromRect:CGRectMake(1, 1, 1, 1) inView:self.view animated:YES];
之类的一些选项,但我需要将Instagram与其他选项一起使用,所以这是要走的路。
我使用的代码:
var x = document.getElementById("demo");
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
function showPosition(position) {
var location = position.coords.latitude + "," + position.coords.longitude;
$(document).ready(function(load) {
var dmJSON = "https://api.wunderground.com/api/0ce1c4a981f7dd2a/geolookup/lang:AR/forecast/conditions/q/"+location+".json";
dataType : "jsonp";
function fetch() {
$.getJSON( dmJSON, function(parsed_json) {
var html = '';
{
html += '<div style="width: 600;direction: rtl;background-color: white;padding: 12px 12px 0;border: 1px solid;border-color: #e5e6e9 #dfe0e4 #d0d1d5;border-radius: 4px;margin-bottom: 20px;color: black;">';
html += '<p>' + parsed_json.current_observation.weather + ' </p>';
html += '</div>';
}
setInterval(function () {
$(news).html("");
fetch();
}, 15000);
fetch();
$("#news").append(html);
})
}
});
} // a