Rodrigo Chavarria
Rodrigo Chavarria

Reputation: 37

How to know the current storyboard name in xamarin iOS?

How can I put in a string variable the name of the current storyboard Ive got this for objective-c

UIStoryboard * storyboard = self.storyboard;
NSString * storyboardName = [storyboard valueForKey:@"name"];

but I have to pass it to Xamarin iOS

Upvotes: 1

Views: 407

Answers (2)

sschmidTU
sschmidTU

Reputation: 132

You can also try this in the storyboard's custom ViewController:

NSString storyboardId = (NSString) ValueForKey(new NSString("storyboardIdentifier"));

To get just the string, you can simply use storyboardId.ToString() (NSString function), though NSString mostly behaves the same way as string, e.g. in Dictionaries.

converted to C# from Swift from this answer: Programmatically get a Storyboard ID?

Upvotes: 0

SushiHangover
SushiHangover

Reputation: 74209

Xamarin.iOS:

var storyBoard = this.Storyboard;
var storyBoardName = storyBoard.ValueForKey(new NSString ("name"));

Upvotes: 2

Related Questions