MCPcopy Create free account
hub / github.com/9miao/CrossApp / parseViewControllItems

Method parseViewControllItems

CrossApp/support/CAUIEditorParser.cpp:1886–1999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1884}
1885
1886void CAUIEditorParser::parseViewControllItems(CAViewController* viewController)
1887{
1888 m_pViewController = viewController;
1889
1890 CC_RETURN_IF(!m_pMyDocument);
1891
1892 tinyxml2::XMLElement* rootElement = m_pMyDocument->RootElement();
1893
1894 tinyxml2::XMLElement* entity = NULL;
1895
1896 entity = rootElement->FirstChildElement("CATabBarItem");
1897
1898 if (entity)
1899 {
1900 //CATabBarItem
1901 std::string barTitle = "";
1902 CAImage* image = NULL;
1903 CAImage* selectImage = NULL;
1904
1905 if (const char* value = entity->Attribute("image"))
1906 {
1907 image = CAImage::create(value);
1908 }
1909 if (const char* value = entity->Attribute("selectImage"))
1910 {
1911 selectImage = CAImage::create(value);
1912 }
1913 if (const char* value = entity->Attribute("title"))
1914 {
1915 barTitle = value;
1916 }
1917 CATabBarItem* item = CATabBarItem::create(barTitle, image, selectImage);
1918 if (const char* value = entity->Attribute("badgeValue"))
1919 {
1920 item->setBadgeValue(value);
1921 }
1922
1923 viewController->setTabBarItem(item);
1924 }
1925
1926 entity = rootElement->FirstChildElement("CANavigationBarItem");
1927 if (entity)
1928 {
1929 //CANavigationItem
1930
1931 CANavigationBarItem* navigationBarItem = NULL;
1932 if (const char* value = entity->Attribute("title"))
1933 {
1934 navigationBarItem = CANavigationBarItem::create(value);
1935 }
1936 if (const char* value = entity->Attribute("titleImage"))
1937 {
1938 navigationBarItem->setTitleViewImage(CAImage::create(value));
1939 }
1940 if (navigationBarItem)
1941 {
1942 tinyxml2::XMLElement* leftXml = entity->FirstChildElement();
1943

Callers 1

parserMethod · 0.80

Calls 7

FirstChildElementMethod · 0.80
AttributeMethod · 0.80
setTabBarItemMethod · 0.80
addLeftButtonItemMethod · 0.80
NextSiblingElementMethod · 0.80
addRightButtonItemMethod · 0.80
setNavigationBarItemMethod · 0.80

Tested by

no test coverage detected