I want to use exchangeSubviewAtIndex: with the SubviewAtIndex: method.
but how can I get the indices of these views? I already have pointers, so I thought there might be such a method.
[parentView indexOfSubview:subview];
but I could not find one in the Xcode document library.
Please help me! thanks in advance.
Here's how you get it:
[parentView.subviews indexOfObject:subview];
You can find out the index of your object as you find in NSArray , since view.subviews return an array
NSUInteger index1=[parentView.subviews indexOfSubview:subview1]; NSUInteger index2=[parentView.subviews indexOfSubview:subview2]; [parentView exchangeSubviewAtIndex:index1 withSubviewAtIndex:index2];
You can follow this link for more. How to get the UIView hierarchy index ??? (i.e. depth between other areas)
[View.subviews indexOfObject:SubView];
You can get the index of the array using this.
[view.subViews indexOfObject:yourSubView];
And try to catch this index.
NSInteger index=[view.subViews indexOfObject:yourSubView];
Try this code, maybe you will find it useful ...
Source: https://habr.com/ru/post/1492427/More articles:javascript split string with two different indices - javascriptXcode: Add git server: "Server disconnected" - githow to redirect my bash request to zsh - bashCommand line style command line - gituse cursor to query from google application in android - androidWPF trigger does not work as intended - triggersWhy can't we create an array of the Concrete class inside a generic class? - javaWhy is the "yet" special character in the pattern? Can this be defined as a procedure? - lispangular remove element from dom if src does not exist - angularjsJson data binding to table in mvc 4 - jsonAll Articles