小编JAY*_*RKA的帖子

如何在swift中的NSMutableArray中将对象添加为NSMutableArray

我想addObjectNSMutableArrayNSMutableArray,所以我怎么能在迅速实现这一目标.并检索它,所以请帮助我,因为现在我正在迅速学习.

间接地说,我想二维数组手段NSMutableArrayNSMutableArray.

//The below 2 lines iterative!
var dict:NSMutableDictionary? = NSMutableDictionary();
 linePointsArray!.addObject(dict!);

// and below 2 line is execute after complete the above iteration
 arrLine!.addObject(linePointsArray!);
 linePointArray!.removeAllObject();

//after that the above whole process is done iterative.
Run Code Online (Sandbox Code Playgroud)

nsmutablearray ios swift

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

在ios中创建一个简单的聊天视图

我需要创建一个简单的聊天视图,在其中我可以像任何消息应用程序一样显示来自两端(发送者和接收者)的消息.

到目前为止,我所做的是创造一个UITableView,A UIButton和一个UITextField.在UIButton上,我将UITextField文本添加到数组中,现在我需要第二个端点,就像我们的Messaging应用程序(发送方)一样.

左侧是接收器,右侧是发送器.

我的应用程序到现在为止

在此输入图像描述

这是我的代码:

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

static NSString *CellIdentifier = @"Cell";

messageLabel = nil;

UITableViewCell *cell = [tableView
                         dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {

    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    messageLabel = [[UILabel alloc] init];
    messageLabel.tag = 101;
    [cell.contentView addSubview: messageLabel];

      } else {


    messageLabel = (UILabel*)[cell.contentView viewWithTag: 101];

      }    //---calculate the height for the label---
int labelHeight = [self labelHeight:[listOfMessages objectAtIndex:indexPath.row]];
labelHeight -= bubbleFragment_height;
if (labelHeight<0) labelHeight = …
Run Code Online (Sandbox Code Playgroud)

iphone chat objective-c uitableview ios

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

验证消息未使用jsf在对话框中呈现

    <p:dialog widgetVar="dlgEdit" header="Add New Status">
        <h:form id="editFrm">
            <h:panelGrid columns="3" id="pnlEdit">
                <p:outputLabel value="Status"/>
                <p:inputText id="txtStatus" required="true"/>
                    <p:message for="txtStatus" />
           </h:panelGrid>
    </p:dialog>
Run Code Online (Sandbox Code Playgroud)

这是一个未在对话框中呈现的primefaces消息标记.对话框隐藏在onComplete事件上.

        How can I RENDER validation message in DIALOG using jsf?
Run Code Online (Sandbox Code Playgroud)

感谢任何建议!

validation primefaces

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

使用NSMutableArray发送到不可变对象的突变方法

我发现由于未捕获的异常“ NSInternalInconsistencyException”而导致的“错误终止”应用程序,原因:“-[__ NSCFArray insertObject:atIndex:]:将变异方法发送给不可变对象”当我第二次将对象添加到可变数组时,第一次成功添加但第二次当它崩溃的应用程序,我认为当我添加对象到数组时有问题。下面的代码是崩溃。

- (void) viewWillAppear:(BOOL)animated
{

    if ([defaults objectForKey:@"Groups"] != nil)
    {
        NSLog(@"not nil defaults.");
        arrGroups = (NSMutableArray *)[defaults objectForKey:@"Groups"];
    }
    else
    {
        NSLog(@"nil defaults.");
        arrGroups = [[NSMutableArray alloc] init];
    }
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{

NSLog(@"button index == %ld",(long)buttonIndex);
//txtCategory = [[alertView textFieldAtIndex:0] text];

if (buttonIndex == 1)
{
    //[self addingCategory:self];
    NSLog(@"Adding Group name = %@",[[alertView textFieldAtIndex:0]text]);
    [arrGroups addObject:[[alertView textFieldAtIndex:0]text]]; **//Crash here! at the time of add second object or also when …
Run Code Online (Sandbox Code Playgroud)

objective-c nsuserdefaults nsmutablearray ios

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

isKindOfClass每次都返回TRUE?

我有一个scrollView名为svCreateTask.在此scrollView我把UITextField,UITextView,UIButtons静态和UIView编程按下按钮.现在我想删除UIView按下按钮.和视图从其scrollView标签中移除与Button标签相同.

并且if语句每次检查都是TRUE,因此其标签与我的按钮标签相同的其他子视图也会从中删除scrollView.我只想删除UIView.

在这里,我发布我的代码:

 NSLog(@"Enter in removeNotification method.");

    UIButton *btn = (UIButton *)sender;
    NSLog(@"btn Tag = %d",[btn tag]);

    NSArray *viewsToRemove = [svCreateTask subviews];

    for (int i=0; i<viewsToRemove.count; i++)
    {
        NSLog(@"Class == %@",[[viewsToRemove objectAtIndex:i] class]);
        if ([[viewsToRemove objectAtIndex:i]isKindOfClass:[UIView class]])
        {
            NSLog(@"In Class Check...");
            UIView *v =[viewsToRemove objectAtIndex:i];
            if (v.tag == btn.tag)
            {
                [v removeFromSuperview];
            }
        }

    }
Run Code Online (Sandbox Code Playgroud)

我的NSLog是.

2014-05-13 14:49:42.769 TOPDesign[379:11303] Enter …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch if-statement objective-c ios

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