Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

TZStackView Storyboard Support does not seem to be working #4

Closed
SOFSPEEL opened this issue Feb 12, 2017 · 7 comments
Closed

TZStackView Storyboard Support does not seem to be working #4

SOFSPEEL opened this issue Feb 12, 2017 · 7 comments

Comments

@SOFSPEEL
Copy link

TZStackView is supposed to support Storyboards (says so in ReadMe), but the vertical StackView is not laying out properly. One thing I noticed is that in the Xamarin design view I get an "Error while creating this entry" screen shot below.

Also I'm attaching my Xamarin project (see Junk.zip), where u'll see that the StackView setup in ViewController.cs is totally ignored:
StackView.Distribution = TZStackView.Distribution.FillEqualy;
StackView.Alignment = TZStackView.Alignment.Fill;
StackView.Spacing = 25;
StackView.Axis = UILayoutConstraintAxis.Vertical;
StackView.TranslatesAutoresizingMaskIntoConstraints = false;

Essentially all I'm trying to do is setup a vertical stackview where the button fill the width of the stackview and space equal vertically with some space, without setting any constraints on the stackview subviews (i.e. the buttons).

image

junk5.zip

@SOFSPEEL
Copy link
Author

My Xamarin and Xcode are all latest or near latest versions:

=== Xamarin Studio Enterprise ===

Version 6.1.5 (build 0)
Installation UUID: 71b01f6e-97e9-48b1-ace8-9ab3fd6fa8fa
Runtime:
Mono 4.6.2 (mono-4.6.0-branch/ac9e222) (64-bit)
GTK+ 2.24.23 (Raleigh theme)

Package version: 406020016

=== NuGet ===

Version: 3.4.3.0

=== Xamarin.Profiler ===

Version: 0.38.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.2.1 (11766.1)
Build 8C1002

=== Xamarin.Android ===

Version: 7.0.2.42 (Xamarin Enterprise)
Android SDK: /Users/steve.fiedelberg/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.4 (API level 19)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 23.0.3

Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: 10.3.1.8 (Xamarin Enterprise)
Hash: 7beaef4
Branch: cycle8-xi
Build date: 2016-12-20 02:58:14-0500

=== Xamarin.Mac ===

Version: 2.10.0.120 (Xamarin Enterprise)

=== Build Information ===

Release ID: 601050000
Git revision: 7494718e127af9eaec45a3bd6282d3da927488bd
Build date: 2017-01-17 10:31:01-05
Xamarin addins: c92d0626d347aaa02839689eaac2961d24c9f446
Build lane: monodevelop-lion-cycle8

=== Operating System ===

Mac OS X 10.11.6
Darwin sf 15.6.0 Darwin Kernel Version 15.6.0
Mon Jan 9 23:07:29 PST 2017
root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64

@Cheesebaron
Copy link
Owner

Thanks for reporting this. Will have a look at what is going on here.

Do you see any error output anywhere?

@SOFSPEEL
Copy link
Author

No ApplicationOutput window has nothing relevant in it.

@SOFSPEEL
Copy link
Author

I tried to isolate the "Error while creating this entry" issue, seems to be an issue with enum properties on custom views, the following code results in the same design time error.

Wondering if the enum needs to be decorated somehow, although the following article on using enum's doesn't decorate.
https://blog.xamarin.com/build-custom-controls-with-the-xamarin-designer-for-ios/


namespace Junk7
{
	[Register("AView")]
	[DesignTimeVisible(true)]
	public class AView : UIView
	{


		Distribution _distribution;
        public AView(IntPtr handle) : base(handle) { }

		[Export("Disribution"), Browsable(true)]
		public Distribution Distribution
		{
			get { return _distribution; }
			set
			{
				_distribution = value;

			}
		}


	}
}
public enum Distribution
	{
		Hello,
		Goodby

	}

@SOFSPEEL
Copy link
Author

I did make some progress on this. So I think there are 2 problems:

  • Xamarin support for design enum properties not working. This is the minor problem because the properties can be set programatically.
  • Bigger problem though is that TZStackView does not really support storyboard, and by that i specifically I mean, dropping controls into the TZStackView doesn't work.

I analyzed https://github.com/Cheesebaron/TZStackView/blob/master/TZStackView/StackView.cs and think the root cause is that the subviews added via the storyboard to the stackview do not make it ArrangedSubviews.

I did a little experiment and modified StackView.cs to reference SubViews instead of ArrangedSubviews and things started to work. Here I'm attaching:

StackView.cs.zip

This may help get to the bottom of the problem.

@Cheesebaron
Copy link
Owner

Sorry cant accept arbitrary zip files. Please use a gist instead.

@SOFSPEEL
Copy link
Author

Think I got to the bottom of this, the issue is that this version of TZStackView is not IB compatible. Note that in the Xcode version there is still a pull request outstanding tomvanzummeren/TZStackView#57 that makes the StackView IB compliant, and I don't think that's been implemented in this version.

So I suggest either changing the readme to indicate that this version is not IB compatible, or implemented the PR here.

The other enumeration designer issue is believe a Xamarin problem so I'll file a bug with them.

Cheesebaron added a commit that referenced this issue Mar 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants