Rya*_*yan 9 c# objective-c xamarin.ios
我正在将一些Objective C代码转换为C#,以便在Monotouch iPhone应用程序中使用.
在目标C中,测试了以下等价条件:
if ([cell.backgroundView class] != [UIView class])
... do something
Run Code Online (Sandbox Code Playgroud)
细胞是一个UITableViewCell.
在C#中,我想使用(到目前为止)以下测试相同的条件:
if ( !(cell.BackgroundView is UIView))
... do something
Run Code Online (Sandbox Code Playgroud)
对Objective C代码的理解是否正确,即它测试的类型是cell什么?C#中的等价物是什么?
看起来正确,除非UITableViewCell继承UIView.
在这种情况下你需要
if (cell.BackgroundView.GetType() != typeof(UIView))
... do something
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3391 次 |
| 最近记录: |