小编Mus*_*P P的帖子

为什么我们要检查UITableViewController中是否(cell == nil)?

我正在尝试实现基于UITableView的Application.For我选择UITableViewStyle是Group.在我的TableView中它们是15节,每节有1行.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 15;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==12) 
    {
        return 120;
    }
    else
    {
        return 60;
    }

}
Run Code Online (Sandbox Code Playgroud)

我想在第12节添加一个UITextView

为此,我做了以下代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];



    }
    if ([indexPath section] == 12) 
    {
        if([indexPath row]==0)
        {
            descriptionTextField=[[UITextView alloc] …
Run Code Online (Sandbox Code Playgroud)

objective-c cell uitableview ios

7
推荐指数
1
解决办法
9452
查看次数

是否有可能改变UIButton的行动?

我试图在ios应用程序中更改UIButton的操作.我做了以下代码

 button = [UIButton buttonWithType:UIButtonTypeRoundedRect];

    [button addTarget:self  action:@selector(aMethodShow:) forControlEvents:UIControlEventTouchDown];

    [button setTitle:@"Show View" forState:UIControlStateNormal];

    button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);

    [view addSubview:button];
Run Code Online (Sandbox Code Playgroud)

特别是第一节我想改变这个按钮的动作.所以我这样做了

[button addTarget:self  action:@selector(aMethodHide:) forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Hide View" forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)

不幸的是这段代码注意工作

xcode action objective-c uibutton ios

5
推荐指数
2
解决办法
9080
查看次数

如何在iOS应用程序中实现信号量?

是否可以在ios应用程序中实现Counting Semaphore?

semaphore objective-c ios

5
推荐指数
2
解决办法
2万
查看次数

如何通过WiFi连接iPhone应用程序上的多个对等体?

我有一个ios(iPhone)应用程序的想法,需要连接到几个同行.我的代码基于WiTab(SampleCode-developer.apple.com)示例.

当我的应用程序启动时,每个对等体创建单独的Socket(CFSocket)并通过NSNetService Class发布.在特定实例NSNetServiceBrowser类中找到可用的对等体.并在TableView中显示其名称.当我在表视图中选择行解析相应的对等地址时,建立连接并成功发送 - 接收数据.

但我的意图是,我想在tableView中选择多行(多个对等).并解决了所选的对等地址.为此我将选定的对等体信息存储到NSMutableArray.当我单击(触摸)发送按钮时,我想解析所选设备地址并将数据发送到选定的对等点.为此,我做了这个代码

 for(int k=0;k<[selectedService count];k++)
    {

             self.currentResolve = [self.selectedService objectAtIndex:k];         
             self.currentResolve = [self.selectedSer objectAtIndex:k];     
             [self.currentResolve setDelegate:self];    
             [self.currentResolve resolveWithTimeout:60];           
  }
Run Code Online (Sandbox Code Playgroud)

但是它只会解析一个设备(self.selectedService objectAtIndex:0).那我怎样才能解析多个对等体地址/如何为多个设备建立连接.所以我的怀疑是: -

  1. 是否可以通过WiFi同时连接多个设备?
  2. 如果是,则可以以相同模式连接的最大设备数是多少?
  3. 哪种类型的CFSocket对多个连接(TCP/UDP)有用?
  4. 是否需要在每个对等体中创建多个CFSocket?
  5. 如果是,怎么样?他们的文件是什么?
  6. 是否需要建立会话?
  7. 如何解决mutple设备的地址?

objective-c wifi nsnetservice ios cfsocket

4
推荐指数
1
解决办法
2093
查看次数

iPhone应用程序中的Settings.Bundle

我正在尝试实现基于Settings.Bundle的应用程序.为此,我在我的应用程序中实现了Settings.bundle,并在系统设置应用程序中输出.

在此输入图像描述

如何在我的应用程序中访问此视图?可能吗?

iphone nsuserdefaults ios xcode4 settings.bundle

3
推荐指数
1
解决办法
591
查看次数