我在iPhone项目中使用Objective-C创建了一个屏幕.在那里,有2个按钮(比如A和B).在单击按钮A时,将在文件夹(例如INBOX)中创建一个xml文件.
我的问题是,我只有在文件夹INBOX中不存在时才需要创建文件.我怎样才能做到这一点?任何人都可以告诉我语法吗?
如何使用switch case而不是编写以下方法if else
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException
{
currentElement = true;
if (localName.equals("maintag"))
{
/** Start */
sitesList = new SitesList();
} else if (localName.equals("website")) {
/** Get attribute value */
String attr = attributes.getValue("category");
sitesList.setCategory(attr);
}
}
Run Code Online (Sandbox Code Playgroud)