Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Clone in Desktop Download ZIP

Loading…

iPad のサポート #131

Open
wants to merge 10 commits into from

2 participants

@Watson1978

iPad のサポートを追加し、iOS 9 で追加された Split View に対応させてみました。

Split View に対応させるために LaunchScreen.storyboard を追加していますが、
iPhone 上でも起動時にこれが表示されるようになるはずです。
(適当に追加したので、修正した方が良いのかも・・・)

iPad を回転させたときに画面がみだれる現象があり対応してますが、
まだおかしな箇所があればご連絡ください。

@naoya
Owner

おお・・・すごいw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
11 Rakefile
@@ -12,9 +12,9 @@ Motion::Project::App.setup do |app|
app.name = 'HBFav'
app.version = "2.8.2"
app.short_version = "2.8.2"
- app.sdk_version = '8.1'
+ app.sdk_version = '9.0'
app.deployment_target = '7.0'
- app.device_family = [:iphone]
+ app.device_family = [:iphone, :ipad]
app.identifier = "HBFav"
app.prerendered_icon = true
app.status_bar_style = :light_content
@@ -37,6 +37,13 @@ Motion::Project::App.setup do |app|
end
app.interface_orientations = [:portrait]
+ app.info_plist['UISupportedInterfaceOrientations~ipad'] = [
+ 'UIInterfaceOrientationPortrait',
+ 'UIInterfaceOrientationPortraitUpsideDown',
+ 'UIInterfaceOrientationLandscapeLeft',
+ 'UIInterfaceOrientationLandscapeRight'
+ ]
+ app.info_plist['UILaunchStoryboardName'] = 'LaunchScreen'
app.info_plist['NSAppTransportSecurity'] = {
'NSAllowsArbitraryLoads' => true
View
8 app/controller/base/hbfav2_ui_table_view_controller.rb
@@ -15,5 +15,13 @@ def viewDidLoad
self.tableView.separatorColor = '#ddd'.uicolor
end
end
+
+ def willAnimateRotationToInterfaceOrientation(orientation, duration:duration)
+ self.view.reloadData
+ end
+
+ def viewWillTransitionToSize(size, withTransitionCoordinator:coordinator)
+ self.view.reloadData
+ end
end
end
View
12 app/controller/base/hbfav2_ui_view_controller.rb
@@ -15,5 +15,17 @@ def viewDidAppear(animated)
super
self.navigationItem.backBarButtonItem = NavigationBackButton.create
end
+
+ def willAnimateRotationToInterfaceOrientation(orientation, duration:duration)
+ # FIXME : Just rotate. need better way for iOS 7.
+ v = self.view.subviews.first
+ frame = v.frame
+ v.frame = CGRectMake(0, 0, frame.size.height, frame.size.width)
+ end
+
+ def viewWillTransitionToSize(size, withTransitionCoordinator:coordinator)
+ v = self.view.subviews.first
+ v.frame = CGRectMake(0, 0, size.width, size.height)
+ end
end
end
View
3  app/controller/bookmark_view_controller.rb
@@ -143,6 +143,9 @@ def open_hatena_bookmark_view
def on_action
controller = URLActivityViewController.alloc.initWithDefaultActivities([ @bookmark.title, @bookmark.link.nsurl ])
+ if controller.popoverPresentationController
+ controller.popoverPresentationController.sourceView = self.view
+ end
self.presentViewController(controller, animated:true, completion:nil)
end
View
8 app/controller/left_view_controller.rb
@@ -139,6 +139,14 @@ def observeValueForKeyPath(keyPath, ofObject:object, change:change, context:cont
end
end
+ def willAnimateRotationToInterfaceOrientation(orientation, duration:duration)
+ self.view.reloadData
+ end
+
+ def viewWillTransitionToSize(size, withTransitionCoordinator:coordinator)
+ self.view.reloadData
+ end
+
def dealloc
ApplicationUser.sharedUser.removeObserver(self, forKeyPath:'hatena_id')
super
View
9 app/controller/web_view_controller.rb
@@ -204,9 +204,12 @@ def open_hatena_bookmark_view
end
def on_action
- present_modal(
- URLActivityViewController.alloc.initWithDefaultActivities([@bookmark.title, @bookmark.link.nsurl])
- )
+ controller = URLActivityViewController.alloc.initWithDefaultActivities([@bookmark.title, @bookmark.link.nsurl])
+ if controller.popoverPresentationController
+ controller.popoverPresentationController.sourceView = self.view
+ end
+
+ present_modal(controller)
end
def on_close
View
BIN  resources/Default-Landscape.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/Default-Landscape@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/Default-Portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/Default-Portrait@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/LaunchScreen-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
41 resources/LaunchScreen.storyboard
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15B22c" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
+ <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="LaunchScreen-logo" translatesAutoresizingMaskIntoConstraints="NO" id="6sl-r1-1nk">
+ <rect key="frame" x="95" y="403" width="100" height="100"/>
+ <animations/>
+ </imageView>
+ </subviews>
+ <animations/>
+ <color key="backgroundColor" red="0.13333333333333333" green="0.50588235294117645" blue="0.76470588235294112" alpha="1" colorSpace="calibratedRGB"/>
+ <constraints>
+ <constraint firstItem="6sl-r1-1nk" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leadingMargin" id="Cc9-Xa-m0D"/>
+ <constraint firstItem="xb3-aO-Qok" firstAttribute="top" secondItem="6sl-r1-1nk" secondAttribute="bottom" constant="21" id="xQQ-tG-LxJ"/>
+ </constraints>
+ </view>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+ <resources>
+ <image name="LaunchScreen-logo" width="16" height="16"/>
+ </resources>
+</document>
Something went wrong with that request. Please try again.