我想addObject的NSMutableArray到NSMutableArray,所以我怎么能在迅速实现这一目标.并检索它,所以请帮助我,因为现在我正在迅速学习.
间接地说,我想二维数组手段NSMutableArray的NSMutableArray.
//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) 我需要创建一个简单的聊天视图,在其中我可以像任何消息应用程序一样显示来自两端(发送者和接收者)的消息.
到目前为止,我所做的是创造一个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) <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)
感谢任何建议!
我发现由于未捕获的异常“ 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) 我有一个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) ios ×4
objective-c ×3
chat ×1
cocoa-touch ×1
if-statement ×1
iphone ×1
primefaces ×1
swift ×1
uitableview ×1
validation ×1