This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIImage *instaImage = [UIImage imageNamed:@"imagetoShare.png"]; | |
NSString* imagePath = [NSString stringWithFormat:@"%@/image.igo",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, | |
NSUserDomainMask, YES) lastObject]]; | |
[[NSFileManager defaultManager] removeItemAtPath:imagePath error:nil]; | |
[UIImagePNGRepresentation(instaImage) writeToFile:imagePath atomically:YES]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIImage *instaImage = [UIImage imageNamed:@"imagetoShare.png"]; | |
NSString* imagePath = [NSString stringWithFormat:@"%@/image.igo",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, | |
NSUserDomainMask, YES) lastObject]]; | |
[[NSFileManager defaultManager] removeItemAtPath:imagePath error:nil]; | |
[UIImagePNGRepresentation(instaImage) writeToFile:imagePath atomically:YES]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let image = UIImage(named: "imageToShare") | |
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String | |
let checkValidation = FileManager.default | |
let getImagePath = paths.appending("image.igo") | |
try? checkValidation.removeItem(atPath: getImagePath) | |
let imageData = UIImageJPEGRepresentation(image!, 1.0) | |
try? imageData?.write(to: URL.init(fileURLWithPath: getImagePath), options: .atomicWrite) | |
var documentController : UIDocumentInteractionController! | |
documentController = UIDocumentInteractionController.init(url: URL.init(fileURLWithPath: getImagePath)) | |
documentController.uti = "com.instagram.exclusivegram" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@property(nonatomic,strong) UIDocumentInteractionController *_docController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIImage *instaImage = [UIImage imageNamed:@"imageToShare.png"]; | |
NSString* imagePath = [NSString stringWithFormat:@"%@/image.png",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]]; | |
[[NSFileManager defaultManager] removeItemAtPath:imagePath error:nil]; | |
[UIImagePNGRepresentation(instaImage) writeToFile:imagePath atomically:YES]; | |
self._docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:imagePath]]; | |
[self._docController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBOutlet var pageControl: UIPageControl? | |
@IBOutlet var scrollView: UIScrollView? | |
var scrollWidth : CGFloat = UIScreen.main.bounds.size.width | |
var scrollHeight : CGFloat = UIScreen.main.bounds.size.height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func changePage(){ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
@IBOutlet var pageControl: UIPageControl? | |
@IBOutlet var scrollView: UIScrollView? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func changePage(){ | |
scrollView!.scrollRectToVisible(CGRectMake( scrollWidth * CGFloat ((pageControl?.currentPage)!), 0, scrollWidth, scrollHeight), animated: true) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func scrollViewDidEndDecelerating(scrollView: UIScrollView) { | |
setIndiactorForCurrentPage() | |
} | |
func setIndiactorForCurrentPage() { | |
let page = (scrollView?.contentOffset.x)!/scrollWidth | |
pageControl?.currentPage = Int(page) | |
} |
OlderNewer