Skip to content

Commit

Permalink
Merge feature/develop into master
Browse files Browse the repository at this point in the history
  • Loading branch information
soberman committed Jan 25, 2016
2 parents f08e456 + 6898007 commit 2fc06f7
Show file tree
Hide file tree
Showing 18 changed files with 1,225 additions and 97 deletions.
113 changes: 113 additions & 0 deletions ARSLineProgress.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
Pod::Spec.new do |s|

s.name = "ARSPopover"
s.version = "2.2.1"
s.summary = "Universal popover for iPhone and iPad."

s.description = <<-DESC
# ARSPopover
Universal popover for iPhone and iPad that you can use in your projects. No custom drawing, no custom elements - everything is purely native.
| iPhone | iPad |
| ---------------------------- | ------------------------ |
| ![ARSPopover-iPhone][iPhone] | ![ARSPopover-iPad][iPad] |
[iPhone]: http://git.arsenkin.com/ARSPopover-iPhone.gif
[iPad]: http://git.arsenkin.com/ARSPopover-iPad.gif
## Installation
### CocoaPods
To install with [CocoaPods](http://cocoapods.org/), copy and paste this in your *.pod* file:
platform :ios, '8.3'
pod 'ARSPopover', '~> 2.0'
### Non-CocoaPods way
You can always to do the old way - just drag the source files into your projects and you are good to go.
## Usage
Sample usage of the ARSPopover might look like this:
``` objective-c
- (IBAction)showPopoverWithWebView:(id)sender {
ARSPopover *popoverController = [ARSPopover new];
popoverController.sourceView = self.buttonWithWebView;
popoverController.sourceRect = CGRectMake(CGRectGetMidX(self.buttonWithWebView.bounds), CGRectGetMaxY(self.buttonWithWebView.bounds), 0, 0);
popoverController.contentSize = CGSizeMake(400, 600);
popoverController.arrowDirection = UIPopoverArrowDirectionUp;
[self presentViewController:popoverController animated:YES completion:^{
[popoverController insertContentIntoPopover:^(ARSPopover *popover, CGSize popoverPresentedSize, CGFloat popoverArrowHeight) {
CGFloat originX = 0;
CGFloat originY = 0;
CGFloat width = popoverPresentedSize.width;
CGFloat height = popoverPresentedSize.height - popoverArrowHeight;
CGRect frame = CGRectMake(originX, originY, width, height);
UIWebView *webView = [[UIWebView alloc] initWithFrame:frame];
webView.scalesPageToFit = YES;
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]];
[popover.view addSubview:webView];
}];
}];
}
```
### Required properties' configurations
In order to get a working popover, you need to specify next properties:
* `popoverController.sourceView` - The view containing the anchor rectangle for the popover.
``` objective-c
popoverController.sourceView = self.buttonWithWebView;
```
* `popoverController.sourceRect` - The rectangle in the specified view in which to anchor the popover.
``` objective-c
popoverController.sourceRect = CGRectMake(CGRectGetMidX(self.buttonWithWebView.bounds), CGRectGetMaxY(self.buttonWithWebView.bounds), 0, 0);
```
* `popoverController.contentSize` - The preferred size for the popover’s view.
``` objective-c
popoverController.contentSize = CGSizeMake(400, 600);
```
* And the last, most important thing - you have to call method `insertContentIntoPopover` and pass a block of code, which should add subviews to popover's view you wish to see.
_Be sure to call this method only after you have presented popup. Otherwise you might get wrong size in popoverPresentedSize._
``` objective-c
[popoverController insertContentIntoPopover:^(ARSPopover *popover, CGSize popoverPresentedSize, CGFloat popoverArrowHeight) {
CGFloat originX = 0;
CGFloat originY = 0;
CGFloat width = popoverPresentedSize.width;
CGFloat height = popoverPresentedSize.height - popoverArrowHeight;
CGRect frame = CGRectMake(originX, originY, width, height);
UIWebView *webView = [[UIWebView alloc] initWithFrame:frame];
webView.scalesPageToFit = YES;
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]];
[popover.view addSubview:webView];
}];
```
## License
ARSPopover is released under the [MIT license](http://opensource.org/licenses/MIT). See LICENSE for details.
DESC

s.homepage = "https://github.com/soberman/ARSPopover"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Yarik Arsenkin" => "info@arsenkin.com" }
s.social_media_url = "http://twitter.com/Soberman777"
s.platform = :ios, "8.3"
s.source = { :git => "https://github.com/soberman/ARSPopover.git", :tag => "2.2.1" }
s.source_files = "Source/ARSPopover.{h,m}"
s.exclude_files = "Demo/*"
s.public_header_files = "Source/ARSPopover.h"
s.requires_arc = true

end
46 changes: 0 additions & 46 deletions ARSLineProgress/AppDelegate.swift

This file was deleted.

25 changes: 0 additions & 25 deletions ARSLineProgress/Base.lproj/Main.storyboard

This file was deleted.

25 changes: 0 additions & 25 deletions ARSLineProgress/ViewController.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,22 @@
276406C01C3832B700BCE105 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 276406BE1C3832B700BCE105 /* Main.storyboard */; };
276406C21C3832B700BCE105 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 276406C11C3832B700BCE105 /* Assets.xcassets */; };
276406C51C3832B700BCE105 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 276406C31C3832B700BCE105 /* LaunchScreen.storyboard */; };
27E116281C55844300661F75 /* ARSLineProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E116271C55844300661F75 /* ARSLineProgress.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
27454BCF1C4C17F700DBB38C /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
276406B71C3832B600BCE105 /* ARSLineProgress.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ARSLineProgress.app; sourceTree = BUILT_PRODUCTS_DIR; };
276406BA1C3832B600BCE105 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -22,6 +36,7 @@
276406C11C3832B700BCE105 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
276406C41C3832B700BCE105 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
276406C61C3832B700BCE105 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
27E116271C55844300661F75 /* ARSLineProgress.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARSLineProgress.swift; path = ../../Source/ARSLineProgress.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -54,8 +69,9 @@
276406B91C3832B600BCE105 /* ARSLineProgress */ = {
isa = PBXGroup;
children = (
276406BA1C3832B600BCE105 /* AppDelegate.swift */,
27E116271C55844300661F75 /* ARSLineProgress.swift */,
276406BC1C3832B600BCE105 /* ViewController.swift */,
276406BA1C3832B600BCE105 /* AppDelegate.swift */,
276406BE1C3832B700BCE105 /* Main.storyboard */,
276406C11C3832B700BCE105 /* Assets.xcassets */,
276406C31C3832B700BCE105 /* LaunchScreen.storyboard */,
Expand All @@ -74,6 +90,7 @@
276406B31C3832B600BCE105 /* Sources */,
276406B41C3832B600BCE105 /* Frameworks */,
276406B51C3832B600BCE105 /* Resources */,
27454BCF1C4C17F700DBB38C /* Embed Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -136,6 +153,7 @@
buildActionMask = 2147483647;
files = (
276406BD1C3832B600BCE105 /* ViewController.swift in Sources */,
27E116281C55844300661F75 /* ARSLineProgress.swift in Sources */,
276406BB1C3832B600BCE105 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -249,7 +267,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = ARSLineProgress/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.arsenkin.ARSLineProgress;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -260,7 +283,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = ARSLineProgress/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.arsenkin.ARSLineProgress;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -286,6 +314,7 @@
276406CB1C3832B700BCE105 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
23 changes: 23 additions & 0 deletions Demo/ARSLineProgress/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// AppDelegate.swift
// ARSLineProgress
//
// Created by Yaroslav Arsenkin on 02.01.16.
// Copyright © 2016 Iaroslav Arsenkin. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
Expand Down
6 changes: 6 additions & 0 deletions Demo/ARSLineProgress/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "ios-9-wallpapers-4.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2fc06f7

Please sign in to comment.