MGInstagram 1.1.0

MGInstagram 1.1.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2017年8月

Mark Glagola 维护。



  • Mark Glagola

MGInstagram 是一款 iOS 工具,用于从您的应用程序发布图片到 Instagram。

过程

  • 当尝试发布图片时,会显示“openInMenu”。(目前向 Instagram 发布的唯一方式)
  • 用户可以选择取消或选择 Instagram
  • 如果用户选择 Instagram,用户将被带到带有图片的 Instagram 应用。

设置

建议使用 CocoaPods。

手动

  • 将 MGInstagram 文件夹拖放到您的 iOS 项目中
  • 在您计划使用 MGInstagram 的文件中导入 #import "MGInstagram.h"

MGInstagram 可用方法

//Create an instance
self.instagram = [[MGInstagram alloc] init];

//Set the photo file name
//The following will present various options including Instagram
self.instagram.photoFileName = @"TempPhoto.png";
//The following will only show Instagram as an option
self.instagram.photoFileName = kInstagramOnlyPhotoFileName;

//Checks to see user has the instagram app installed
//Returns YES if user does have the app
[MGInstagram isAppInstalled];

//Post UIImage to Instagram
//Presents an "openInMenu" model in the UIView specified  
//User is only given Instagram as an option
[self.instagram postImage:image inView:self.view];

//You can also post with a caption!
[self.instagram postImage:image withCaption:@"This is an #MGInstagram Caption Test" inView:self.view];

//Checks if the UIImage is at least 612x612 pixels.
//Instagram upscales photos below this resolution, so it is
//recommended to ONLY allow for photos above 612x612 to ensure good quality.
//However, this is your choice whether or not to check.
//Returns YES if correct size
[MGInstagram isImageCorrectSize:image];

示例用法

UIImage *image = [UIImage imageNamed:@"MyImageName.png"];
if ([MGInstagram isAppInstalled] && [MGInstagram isImageCorrectSize:image]) {
    [self.instagram postImage:image inView:self.view];
}
else {
   	NSLog(@"Error Instagram is either not installed or image is incorrect size");
}