xamarin / mac-samples

Sample programs showing how to use Xamarin.Mac on OSX.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating a custom view in XCode and then adding instances programmatically to my main application

velara3 opened this issue · comments

I have a case where I will have repeating multiple square size instances of the same set of form components. Almost like 8 or more small view forms in a grid pattern.

I can either create 8 or more instances manually in my form or what I'd rather do is create a view (or Item Renderer) and then dynamically add instances of that view to my main view.

How do I add a create and add a custom view dynamically to the main view in my xamarin form?

If IIUC:

  • Create a view in XCode Interface Builder
  • In ViewDidLoad create an instance of the custom instance views
    = Add each instance to the main view
  • I'd read a guide if there was one but I can't find anything specifically on this.

Here's the original post with code examples. I can copy the code samples over if thats helpful:

https://stackoverflow.com/questions/67586420/how-to-add-a-custom-view-dynamically-to-a-view-in-visual-studio-for-mac-c-sharp

This repo is about sample applications. Only issues on the samples should be filled here.

The broader developer community would be the best and quickest place for additional troubleshooting help on your questions. Posting a question on Stack Overflow [0] or the .NET on Q&A Forum [1] would be the best next step.

[0] https://stackoverflow.com/questions/tagged/xamarin
[1] https://docs.microsoft.com/en-us/answers/products/dotnet

OK FYI Stack Overflow on Xamarin and Visual Studio has been pretty non existent. :(

What if we change this into a feature request for a new sample application?

Unsolicited advice that always goes over well:
I can't recommend Visual Studio on Mac if their's no support outside of Microsofts own forums.