English 中文(简体)
与C#相比,目标C执行议定书的协同效应如何?
原标题:Syntax for implementing a protocol in Objective C, as compared to C#?

我公司发生意外事件后,我起草了一份短短时间书写和释放一台电话,尽管我没有目标C方面的经验。 我对一些辛迪加感到不安:

我有以下方法定义:

- (UITableViewCell *)tableView:(UITableView *)tableView
     cellForRowAtIndexPath:(NSIndexPath *)indexPath {

}

它生活在一个与这一接口界定的类别中:

@interface TableExampleViewController : UIViewController 
    <UITableViewDelegate, UITableViewDataSource>
{
    NSArray *lightbulbs;
}

方法声明的含义是什么? 我的理解是,UITableViewCell *> 是回归类型,cellForRowAtIndexPath 是方法名称,(NSIndexPath *) indedPath是参数,但tableView:UITableView *)是何等重要内容? 我认为,这与本类执行的各项议定书有关。 c#中的对应合成物是什么?

最佳回答

在目标C中,方法名称包括所有理由名称,因此方法的名称是

tableView:cellForRowAtIndexPath:

包括两个上校<代码>:

它与议定书的执行毫无关系,只是目标C中指明的方法。

UITableViewCell tableViewcellForRowAtIndexPath(UITableView tableView, NSIndexPath indexPath)
问题回答
tableView: cellForRowAtIndexPath:

方法名称不同于C#的命名。 (c) 方法定义

UITableViewCell GetCellFromTableViewAtIndexPaht(UITableView tableView, NSIndexPath indexPath)

这是代表设计模式。 基本上,贵方言书记官班上的可调意见书请您的观察控制员为特定指数提供可调用的电文。 因此,请你说,你的控制者有一系列的歌曲,你希望他们出现在桌面上。 然后,你将创建一条新的可调用的电文。 特定指数(指数Path.row)的歌曲标题案文,并将之交回。 由于你因业绩原因应重新使用可调用的电文,我建议在文件中阅读《可观的方案拟订指南》,特别是





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签