Problem : I want to create tab bar based on my JSON response array, this means, if I got 6 elements in response it will create 6 tabs.
Tried : I already made it by using horizontal scrolling collection view but I want to make it by original tab bar.
So, how can I do this?
please tell me the possible solutions and dont put this on hold..
this is my response so how can i do with this?
tabs = (
{
id = 0;
name = Home;
},
{
id = 1;
name = Winkel;
},
{
id = 2;
name = Zoeken;
}
);
})
thanks @Ankit for swift code but when used your code and passing array with named "arr" getting this error Cannot convert value of type 'NSMutableArray' to expected argument type '[[String : Any]]'
here is my code
func web()
{
request(.GET, "http://www.horecasupply.nl/AJAX?function=appStructure", parameters: nil, encoding: .JSON).responseJSON { (response:Response<AnyObject, NSError>) -> Void in
print(response.result.value)
if (response.result.value != nil)
{
self.arr = (response.result.value)!["tabs"] as! NSMutableArray
print(self.arr)
}
loadTabbarsWithArray(arr)
}
and above you can show my json response so how can i solve it
Number of tabs in UITabbarController depends on number of ViewControllers/NavigationControllers we are adding in tabbar.
Depending on the count of service response, you can change the number of viewcontrollers in tabbar at runtime. https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITabBarController_Class/#//apple_ref/occ/instp/UITabBarController/viewControllers
in Swift