XML Writer问题(XML Writer question)
我正在使用XML Writer在我的应用程序中创建一些重要事件的日志。
目前一切正常,假设应用程序正确关闭,但如果不是,则文件未关闭且日志基本丢失。
让我们假设编写一个简单的元素,如下所示:
writer.WriteStartElement(eventName); writer.WriteAttributeString("t", DateTime.Now.ToString()); writer.WriteString(eventBody); writer.WriteEndElement();
有没有办法在此时关闭文件并稍后将其余元素附加到它,然后关闭根元素和xml编写器?
I'm using XML Writer to create a log of some important events in my application.
Currently it all works fine assuming that the application is correctly closed, but if it isnt, the file isnt closed and the log is basically lost.
Let's assume the writing of a simple element, something like this:
writer.WriteStartElement(eventName); writer.WriteAttributeString("t", DateTime.Now.ToString()); writer.WriteString(eventBody); writer.WriteEndElement();
Is there any way to close the file at this point and append the remaining elements to it later and only then closing the root element and xml writer?
原文:https://stackoverflow.com/questions/2352551
最满意答案
我看到两种实现方式:
- 在cellForRowAt方法中,您可以调用accessoryButton.isHidden = true或false
- 更优选的方式 - 用箭头图像创建您自己的自定义UIButton并将其放置在披露指示器的位置上。 并通过isHidden标志设置可见性。
I see two ways of implementing that:
- In cellForRowAt method you can call accessoryButton.isHidden = true or false
- More preferred way - create your own custom UIButton with arrow image and place it on disclosure indicator's position. And set visibility via isHidden flag.
相关问答
更多-
不要使用UITableViewCell的初始化程序,而是从你的笔尖加载单元格: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"EditCell"; EditCell *cell = (EditCell*) [tableView dequeueReusabl ...
-
GetCell()方法的签名已更改。 就是现在: public override UIKit.UITableViewCell GetCell (Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv) { return base.GetCell (item, reusableCell, tv); } 改变的原因是支持重用细胞。 解决这些问题的最简单方法是在代码文件中键入override ,然 ...
-
请注意, 您必须使用透明背景 这是我可以得到的最好的匹配,在photoshop文件中: 请注意,它包含作为图层的REAL iOS IMAGE(从屏幕截图),因此可以进行比较。 http://www.filedropper.com/fakearrowiosnov2013psd 看起来VBK想要UITableView集合中的单一V形。 这是所谓的“披露指标”,而不是UIButton提供的“ 细节披露”。 我想你想要这样的东西: 它是50x80与透明背景。 在按钮或UIImageView顶部使用此图像。 调整大小 ...
-
自定义TableViewCell |(Custom TableViewCell | Swift)[2019-12-12]
你永远不会像这样初始化细胞。 在cellForRowAtIndexPath您调用dequeueReusableCellWithIdentifier并根据indexPath设置单元格。 如果您已在Storyboard文件中创建了单元格,请确保在故事板中设置其标识符。 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ let cell = tab ... -
控制tableviewcell中存在自定义泄露指示符时(Controlling when custom disclosure indicator is present in tableviewcell)[2023-03-28]
我看到两种实现方式: 在cellForRowAt方法中,您可以调用accessoryButton.isHidden = true或false 更优选的方式 - 用箭头图像创建您自己的自定义UIButton并将其放置在披露指示器的位置上。 并通过isHidden标志设置可见性。 I see two ways of implementing that: In cellForRowAt method you can call accessoryButton.isHidden = true or false Mor ... -
我期待披露将在新细胞内,但事实并非如此。 它是在单元格内部,但它似乎在你外面因为它是在图像外部视图。 我们需要将图像视图扩展到披露指标之下。 我做了一个简单的把领空间约束设置为负值的技巧: (以上是绿色视图的约束,在您的情况下图像!) 我还在.xib而不是代码中添加了披露指标: 在.xib它将显示如上图所示,但它在我们运行时起作用: 我没有添加图像,而是添加了绿色的UIView ,这只是为了更快地实现。 你可以用UIImageView做同样的事情。 I was expecting that disclosu ...
-
使用Disclosure Indicator将linke添加到UIVewiTabelCell(add linke to UIVewiTabelCell with Disclosure Indicator)[2023-04-19]
override func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) { if let cell = tableView.cellForRowAtIndexPath(indexPath) as? CustemTableViewCell { // here you can access the cell and it's content } ... -
创建自定义单元格时,请确保将视图控制器添加为按钮操作的目标。 所以在你的视图控制器中(假设它是表视图的数据源): - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // All your standard identifier & dequeueing stuff here if (cell == nil) { ...
-
自定义tableViewCell(Custom tableViewCell)[2023-06-01]
这是一个更方便的数据源的建议 为单元格类型创建枚举 enum CellType { case one, two } CellData结构包含节的标题,单元格类型的数组和文本字符串的数组。 struct CellData { let title : String let typeArray : [CellType] let textArray : [String] } 声明数据源数组 var arrayOfCellData = [CellData]() 在viewDidL ... -
您不需要使用IBOutlet,因为您不想使用IB中的属性 @interface chatCell : UITableViewCell { UIImageView *homeTeamImage; UILabel *homeTeamLabel; UIImageView *awayTeamImage; UILabel *awayTeamLabel; } @property(nonatomic, weak) UIImageView *homeTeamImage; @property ...