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
@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
@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) | |
} |
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
@interface ViewController : UIViewController { | |
IBOutlet UIPageControl *pageControl; | |
IBOutlet UIScrollView *scrollView; | |
} | |
-(IBAction)changePage:(id)sender; | |
@end |
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
#define SCROLLWIDTH 279 | |
- (void)viewDidLoad { | |
scrollView.contentSize=CGSizeMake(SCROLLWIDTH*3, | |
scrollView.frame.size.height); | |
scrollView.delegate = self; | |
for (int i =0; i<=3; i++) { | |
UIImageView *imageView = [[UIImageView alloc]initWithFrame: | |
CGRectMake(SCROLLWIDTH*i, 0, scrollView.frame.size.width, | |
scrollView.frame.size.height)]; | |
if (i==0) { |
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
#pragma mark changePage | |
-(IBAction)changePage:(id)sender | |
{ | |
[scrollView scrollRectToVisible:CGRectMake(SCROLLWIDTH*pageControl.currentPage, scrollView.frame.origin.y, SCROLLWIDTH, scrollView.frame.size.height) animated:YES]; | |
} |
OlderNewer