Skip to content

Commit

Permalink
adds screenshots, tested on Visual Studio Mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebnil committed Apr 29, 2017
1 parent d1c456c commit 4809060
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 48 deletions.
3 changes: 1 addition & 2 deletions CustomView/CustomView.csproj
Expand Up @@ -22,6 +22,7 @@
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
Expand Down Expand Up @@ -91,10 +92,8 @@
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<InterfaceDefinition Include="CustomView.xib" />
<None Include="GettingStarted.Xamarin" />
<None Include="Info.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
<InterfaceDefinition Include="TestView.xib" />
</ItemGroup>
<ItemGroup>
<Compile Include="ViewController.designer.cs">
Expand Down
4 changes: 2 additions & 2 deletions CustomView/CustomView.xib
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="ipad12_9" orientation="portrait">
<adaptation id="fullscreen"/>
Expand Down Expand Up @@ -48,4 +48,4 @@
<point key="canvasLocation" x="-94" y="-75"/>
</view>
</objects>
</document>
</document>
4 changes: 0 additions & 4 deletions CustomView/GettingStarted.Xamarin

This file was deleted.

8 changes: 5 additions & 3 deletions CustomView/Info.plist
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
Expand All @@ -13,7 +13,7 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string></string>
<string>10.2</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
Expand Down Expand Up @@ -41,5 +41,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleName</key>
<string>CustomView</string>
</dict>
</plist>
</plist>
45 changes: 23 additions & 22 deletions CustomView/Main.storyboard
@@ -1,51 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" customColorSpace="sRGB" colorSpace="calibratedRGB" red="0" green="0.50196078431372548" blue="0" alpha="1"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="3" translatesAutoresizingMaskIntoConstraints="NO" text="This is just a label">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This is just a label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3">
<rect key="frame" x="20" y="20" width="223" height="21"/>
<constraints>
<constraint firstAttribute="width" constant="223" id="19"/>
<constraint firstAttribute="height" constant="21" id="20"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="21" customClass="CustomView">
<rect key="frame" x="20" y="49" width="335" height="300"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint id="19" firstItem="3" firstAttribute="width" constant="223"/>
<constraint id="20" firstItem="3" firstAttribute="height" constant="21"/>
<constraint firstAttribute="height" constant="300" id="121"/>
</constraints>
</label>
<view contentMode="scaleToFill" id="21" customClass="CustomView" translatesAutoresizingMaskIntoConstraints="NO">
<rect key="frame" x="24" y="49" width="720" height="300"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="Name" value="Name is set from properties."/>
</userDefinedRuntimeAttributes>
<color key="backgroundColor" colorSpace="calibratedWhite" white="1" alpha="1"/>
<constraints>
<constraint id="121" firstItem="21" firstAttribute="height" constant="300"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.50196078431372548" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint id="17" firstItem="3" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" constant="20"/>
<constraint id="18" firstItem="3" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20"/>
<constraint id="117" firstItem="21" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX"/>
<constraint id="118" firstItem="21" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="4"/>
<constraint id="119" firstItem="8bC-Xf-vdC" firstAttribute="trailingMargin" secondItem="21" secondAttribute="trailing" constant="4"/>
<constraint id="120" firstItem="21" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="29"/>
<constraint firstItem="3" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" constant="20" id="17"/>
<constraint firstItem="3" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" id="18"/>
<constraint firstItem="21" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="117"/>
<constraint firstItem="21" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="4" id="118"/>
<constraint firstAttribute="trailingMargin" secondItem="21" secondAttribute="trailing" constant="4" id="119"/>
<constraint firstItem="21" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="29" id="120"/>
</constraints>
</view>
</viewController>
Expand All @@ -55,6 +56,6 @@
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedScreenMetrics key="destination" type="iPad"/>
<simulatedScreenMetrics key="destination" type="retina47"/>
</simulatedMetricsContainer>
</document>
15 changes: 0 additions & 15 deletions CustomView/TestView.xib

This file was deleted.

Binary file added Readme Images/customview_toolbox.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Readme Images/simulator_run.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Readme Images/storyboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Readme Images/xib1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions readme.md
Expand Up @@ -4,6 +4,22 @@ Example project showing how to create a custom control (UIView) with XIB so that
Custom UIView does not render in storyboard, but can be selected from the toolbox window. If you make rendering in storyboard work, please make a pull request and I will merge it into this repo.
The reason to this example project simply is that I was looking for an example like this but could not find something that was working out of the box.


Design custom view in xib using Visual Studio or Xcode (less buggy)
![xib](https://github.com/sebnil/XamarinCustomViewExample/blob/master/Readme Images/xib1.png)


CustomView is visible in Toolbox:
![Toolbox](https://github.com/sebnil/XamarinCustomViewExample/blob/master/Readme Images/customview_toolbox.png)


CustomView can be droped into your storyboard:
![Storyboard](https://github.com/sebnil/XamarinCustomViewExample/blob/master/Readme Images/storyboard.png)

Simulator run. View can also be resized/rotated during runtime:
![Storyboard](https://github.com/sebnil/XamarinCustomViewExample/blob/master/Readme Images/simulator_run.png)


## Getting Started

Clone and run .sln in Visual Studio.
Expand Down

0 comments on commit 4809060

Please sign in to comment.