小编PJR*_*PJR的帖子

Tableview与复选框

我正在使用此代码与tableview复选框.

- (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];

    cell.accessoryType = UITableViewCellAccessoryNone;

            cell.textLabel.text =@"a";
            int flag = (1 << indexPath.row);
            if (_checkboxSelections & flag) 
            {
                cell.accessoryType = UITableViewCellAccessoryCheckmark;
            }


    return cell;
}



#pragma mark -
#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
               _checkboxSelections ^= (1 << indexPath.row);
    [tableView reloadData];
}

- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ …
Run Code Online (Sandbox Code Playgroud)

iphone checkbox uitableview

2
推荐指数
1
解决办法
7387
查看次数

我的设备自动锁定时获取通知

当设备自动锁定时,我可以在正在运行的应用中收到通知吗?

任何帮助?

iphone notifications objective-c ios

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

带有"&"(&符号)字符的NSXMLParser问题

我的NSXMLParsing因为"&"字符而无法工作..我的代码在下面.请帮忙吗?

 NSString *myRequestString = [NSString stringWithFormat:@"http://abc.com/def/webservices/aa.php?family_id=%d",self.passFamilyId];
//NSLog(@"Requested Service = %@",myRequestString);
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:myRequestString]];
[request setHTTPMethod: @"POST" ];
NSData *downloadedData = [ NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];

NSString *str = [[NSString alloc] initWithData:downloadedData encoding:NSASCIIStringEncoding];
//NSString *contentString = [str stringByReplacingOccurrencesOfString:@"&" withString:@"&amp;"];
NSData * data=[str dataUsingEncoding:NSUTF8StringEncoding];


//NSLog (@"string is :%@" ,str);    

NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:data];   

// Call the XMLParsers's initXMLParse method.
ClientDetailXmlParser *parser = (ClientDetailXmlParser*)[[ClientDetailXmlParser alloc] initXMLParser];
[xmlParser setDelegate:parser];
BOOL success = [xmlParser parse];

// Check for XML …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c nsxmlparser nsxml ios

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

通过iphone配置实用程序安装应用程序时出错

我正在为应用程序创建一个构建版本并将其从iphone配置实用程序安装到设备中,并且它运行良好.

但是,在我的朋友设备中,它没有工作,他有相同的配置文件,我有他的iphone配置实用程序,当他去安装它显示错误

无法在设备上安装应用程序.错误:已添加,修改或删除已签名的资源.

对此有何解决方案?我可以再次安装配置文件吗?还是其他任何问题?它在我的Mac中正常工作

iphone objective-c ipad ios

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

Scrollview 中的两个动态 Stackview

这是我的视图层次结构

ScrollView
 -> View
    -> Stackview1
       -> view1
       -> view2
       .
       .
       .
    -> Stackview1
       -> view1
       -> view2
       .
       .
       .
Run Code Online (Sandbox Code Playgroud)

所以这里我的 stackview 的高度是根据 .swift 文件中添加的视图动态生成的

如果我给超级视图提供底部约束,它只能使用单个堆栈视图,但如果我使用两个堆栈视图,则不会考虑第二个堆栈视图。

ios autolayout swift uistackview

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

如何在 Apple DocC 上添加字符串扩展

我正在检查有关 的新 Apple 文档Xcode 13 beta。我可以build documentation用DocC。

但我看不到为字符串扩展、日期扩展等扩展创建的任何文档。

根据下面的示例,它不会添加任何文档。

extension String {

    /// Description for DocC
    func myMethod() {
       
    }
}
Run Code Online (Sandbox Code Playgroud)

考虑一下,如果我为任何结构或类创建了扩展,那么它就会添加如下代码所示的文档

public struct MyStruct {

}


extension MyStruct {

  /// Description
  func myMethod() {
 
  }
}
Run Code Online (Sandbox Code Playgroud)

这是苹果的默认行为还是我遗漏了什么?

xcode ios swift xcode13 docc

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

UITableview部分可编辑

在我的tableview中有5个部分1)1和2不可编辑而3,4和5可编辑在第1部分使用复选框,2个单选框,3个插入单元格,4个删除单元格,5个移动单元格

所以对于最后3我想我的tableview将是可编辑的+和 - 的标志将显示在单元格的开始.

而不是对于forst 2部分.我试过 - (BOOL)tableView:(UITableView*)tableView canEditRowAtIndexPath:(NSIndexPath*)indexPath

但这不起作用.有什么帮助吗?

iphone objective-c uitableview ios

0
推荐指数
1
解决办法
3609
查看次数