小编bru*_*h51的帖子

如何理解这次崩溃?:SIGBUS BUS_ADRALN

多数民众赞成在堆栈跟踪,我不明白这个错误:

0   CoreFoundation  0x30f57648 ___CFBasicHashFindBucket_Linear_NoCollision + 92  
1   CoreFoundation  0x30f59688 __CFBasicHashAddValue + 692
2   CoreFoundation  0x30eaff9f CFDictionarySetValue + 74
3   UIKit   0x35721a0b -[UITouchesEvent _gestureRecognizersForWindow:] + 282
4   UIKit   0x357215d5 -[UIWindow _sendGesturesForEvent:] + 28
5   UIKit   0x357214ab -[UIWindow sendEvent:] + 66
6   UIKit   0x3570a313 -[UIApplication sendEvent:] + 298
7   UIKit   0x35709c53 _UIApplicationHandleEvent + 5090
8   GraphicsServices    0x31a11e77 PurpleEventCallback + 666
9   CoreFoundation  0x30f1ba97     __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
10  CoreFoundation  0x30f1d83f __CFRunLoopDoSource1 + 166
11  CoreFoundation  0x30f1e60d __CFRunLoopRun + 520
12  CoreFoundation  0x30eaeec3 …
Run Code Online (Sandbox Code Playgroud)

crash crash-reports sigbus ios

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

如何将控制台输出放到uitextview?访问控制台日志

我想在我的应用程序中显示一个UITextView,它应该包含来自控制台的所有输出.

这可能吗?我怎样才能做到这一点?

我问的是,因为我想为特殊的beta测试人员提供"调试功能".

console xcode objective-c uitextview ios

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

重新加载/刷新子视图 - setNeedsDisplay不起作用

我遇到setNeedsDisplay的问题.我有一个带有很多子UIViews的UIView,在Inteface Builder中创建.我还有一个带有IBAction的按钮.在这个IBAction中我想重绘/重新加载所有UIViews(或所有UIElements,如UILabel,UIWebView等等)

我这样做,这对我不起作用,不知道为什么..:

//redraw the UIViews
[self.view_card_0 setNeedsDisplay];
[self.view_card_1 setNeedsDisplay];
[self.view_card_stapel setNeedsDisplay];

//other UI Elements
[self.webView_0 setNeedsDisplay];
[self.webView_1 setNeedsDisplay];
[self.webView_stapel setNeedsDisplay];

[self.lblCardTitle_0 setNeedsDisplay];
[self.lblCardTitle_1 setNeedsDisplay];
[self.lblCardTitle_stapel setNeedsDisplay]; 

[self.img_card_0 setNeedsDisplay];
[self.img_card_1 setNeedsDisplay];
[self.img_card_stapel setNeedsDisplay];
Run Code Online (Sandbox Code Playgroud)

如何重绘/重新加载/刷新所有UIElements/UIViews和Subviews?

编辑1:

我如何加载视图:

detailViewController = [[DetailViewController alloc]  
initWithNibName:@"DetailViewController_iPad" bundle:[NSBundle mainBundle]];  
Run Code Online (Sandbox Code Playgroud)

detailviewcontroller没有viewcontroller,只是uiviews,这里是hierarchie:

  • UIView
    - UIViewContainer
    --- UIView0
    --- UIView1
    --- UIViewStapel

我期望做什么:

*我不想重置UIView,我想改变它们的背景和内容.*

我在我的detailview中有很多子视图(uiviews),见上面的hierarchie.我在UIViews中显示内容,内容来自coreData.
view1包含coreData的当前行.
view0包含coreData的前一行.
viewStapel包含coreData的下一行.

使用IBAction我想迭代coreData行,如果调用了动作,则显示当前的下一行......依此类推.

在Log中,数据已更改,但未在UIViews中显示.因此我需要重绘或重新加载或类似的东西,以显示当前数据.

编辑2:已解决
我已将代码放入一个新方法,并调用此方法已解决了我的问题.

subview redraw uiview ios setneedsdisplay

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

如何跳转到detailview中的下一行

我有一个TableView,它在didSelectRow中加载了一个detailview.我对数据没有任何问题.我正在使用coreData并填充TableView我正在使用NSFetchedResultsController.

现在,我想在detailView中创建next和previous函数以跳转到下一个或上一个Table(row)元素.像Mail-App中的Next Previous.
我知道我必须使用带有IBAction的按钮.

但是我怎么能做到这个功能呢?

谢谢,
brush51

编辑1: 我做到了这样:

- (IBAction) previousCard:(id) sender {  
    NSLog(@"previousBtn");

DashboardViewController *parent = (DashboardViewController *)self.parentViewController;

NSIndexPath *actualIndexPath = selectedRow2;
NSIndexPath * newIndexPath = [NSIndexPath  indexPathForRow:actualIndexPath.row-1 inSection:actualIndexPath.section];
NSLog(@"newIndexPath: %@", newIndexPath);
[parent.tableViews selectRowAtIndexPath:newIndexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle]; //HERE I GET SIGABRT

}
Run Code Online (Sandbox Code Playgroud)

但我得到一个错误:

-[UIViewController tableViews]: unrecognized selector sent to instance 0xd758ae0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableViews]: unrecognized selector sent to instance 0xd758ae0'  
Run Code Online (Sandbox Code Playgroud)

怎么解决这个?

row core-data uitableview nsfetchedresultscontroller ios

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

如何在字符串中替换部分字符串?

我想替换字符串中的字符串.让我来解释一下我的目标是什么.

这是我的字符串

<p>Hello Webseite i want to replace<p>thisPTag</p>which is in the middle 
of the word or in the end of the sentence</p>.  
Run Code Online (Sandbox Code Playgroud)

如果我使用

[string stringByReplacingOccurrencesOfString:@"<p>" withString:@"|break|"]; 
Run Code Online (Sandbox Code Playgroud)

它只取代了第一个

.但是我想要替换所有的p标签,无论是否在句子中,在此之前或之后的空白也无关紧要.
那我该怎么做呢?

不是很重要,但很高兴知道:
请记住,我不想删除html,我只是想替换p-tag来设置中断以获得正确的SSML和TTS(textto speech)

replace objective-c nsstring str-replace ios

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

如何像这个InterfaceBuilder设置一样自动调整标签?

我想以编程方式为uilabel设置自动调整大小设置.
我想要完全相同的设置,如我设置的界面构建器设置,请参阅此处:

http://imageshack.us/photo/my-images/545/bildschirmfoto20120508u.png/

那么如何以编程方式设置它?我想要全宽.

我尝试过:

titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;  
Run Code Online (Sandbox Code Playgroud)

但是当我使用它时,我的标签非常奇怪(在肖像模式中宽度为0,在横向约为100).

怎么办?

xcode interface-builder autosize width uilabel

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

将NSDate保存到CoreData

我想将NSDate从XML保存到coreData.我不知道如何设置NSDate的值.有人能给我一点帮助吗?我的实体属性是NSDate.或者它应该是一个字符串并将日期保存为字符串?

[Sets setValue:[TBXML textForElement:xmlDate] forKey:@"beginDate"];
Run Code Online (Sandbox Code Playgroud)

感谢任何回应和帮助,
brush51

core-data objective-c nsdate setvalue

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

UITableView添加子视图

我想在中添加子视图 UITableView

我试过这样的方式:

[self.tableView addSubView:myView.view];
Run Code Online (Sandbox Code Playgroud)

我没有得到任何错误,但视图没有添加,任何人都可以帮助..?

谢谢.

iphone uitableview addsubview ios

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

如何停止AudioQueue?

我正在使用文本到语音,启动音频工作正常,但我不能阻止它.这是我如何开始音频:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), ^(void) {
        [[self view] setNeedsDisplay];
        [self synthesizeInBackground];
        [queue waitUntilAllOperationsAreFinished];
        [self setIsSpeaking: false];
        [[self view] setNeedsDisplay];

    }); 
Run Code Online (Sandbox Code Playgroud)

synthesizeInBackground

 - (void) synthesizeInBackground {
XLog(@"-----------------------------------entered");


queue = [[NSOperationQueue alloc] init];
XLog(@"queue: %@", queue);

operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(synthesize) object:nil];
XLog(@"operation: %@", operation);

[queue addOperation: operation];

}  
Run Code Online (Sandbox Code Playgroud)

合成

- (void)synthesize {
XLog(@"-----------------------------------entered");



NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

callback_userdata userdata;

NSError *error = nil;

self.paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
self.documentsDirectory = [self.paths objectAtIndex:0];
self.path = [self.documentsDirectory stringByAppendingPathComponent:@"readSearchresults.txt"];
IvonaStreamer *streamer …
Run Code Online (Sandbox Code Playgroud)

core-audio audiotoolbox audioqueue ios

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