例如: <a><strike>example data in here</strike></a>
我想要一个标签内的所有东西,直到最后
/<a>([^<]*)<\/a>/
Run Code Online (Sandbox Code Playgroud)
当标签中没有其他标签时它会起作用<a>,但如果有标签会怎样?
我想知道你是否可以告诉它抓住所有东西,[^</a>]而[^<]不仅仅是.
这样做/<a>(.*)<\/a>/并不奏效.有时我会在<a>标签中获得所有内容,有时我会在该调用中包含大量的行.
NSMutableArray *a1 = [[NSMutableArray alloc] init];
NSMutableArray *a2 = [NSMutableArray array];
TempObj *obj = [[TempObj alloc] init]; //assume this line is repeated for each obj
[a1 addObject:obj];
[a1 addObject:obj2];
[a1 addObject:obj3];
[a1 addObject:obj4];
[obj release];
[obj2 release];
[obj3 release];
[obj4 release];
[a1 release];
Run Code Online (Sandbox Code Playgroud)
好的,所以a2是一个autorelease obj,所以我不必在它上面调用release?另外你怎么知道什么时候得到自动释放对象?
对于a1,我不必遍历数组并首先释放每个对象?如果我调用[a1 removeAllObjects]怎么办?这会调用[[a1 objectAtIndex:#] release];
我是否应该在将这些对象添加到阵列后释放它们?
我刚刚开始了我的一门课程,因为课程刚刚在2周前开始,我们现在正在学习Scheme,因为我稍后会考虑一些原因,但到目前为止他所教的内容基本上是如何写入计划的.当我坐在这里试图保持清醒时,我只是想弄清楚为什么我想知道这个,以及为什么有人使用它.它擅长什么?下周我打算问他,目前在这里学习的目标不仅仅是如何在计划中写东西.
我想知道是否有人可以解释为什么调度回主队列并创建重复NSTimer我不得不将它添加到RUN LOOP因为太火了?即使在使用时performselectorOnMainThread我仍然需要将它添加到RUN LOOP以使其触发.
以下是我的问题示例:
#define queue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
#define mainqueue dispatch_get_main_queue()
- (void)someMethodBeginCalled
{
dispatch_async(queue, ^{
int x = 0;
dispatch_async(mainqueue, ^(void){
if([_delegate respondsToSelector:@selector(complete:)])
[_delegate complete:nil];
});
});
}
- (void)compelete:(id)object
{
[self startTimer];
//[self performSelectorOnMainThread:@selector(startTimer) withObject:nil waitUntilDone:NO];
}
- (void)startTimer
{
NSTimer timer = [NSTimer timerWithTimeInterval:3 target:self selector:@selector(callsomethingelse) userInfo:nil repeats:YES];
//NSDefaultRunLoopMode
[[NSRunLoop currentRunLoop] addTimer:_busTimer forMode:NSRunLoopCommonModes];
}
Run Code Online (Sandbox Code Playgroud)
编辑:
我相信我措辞很差.如果我打电话,我想知道为什么 [[NSRunLoop currentRunLoop] addTimer:_busTimer forMode:NSRunLoopCommonModes];有必要.如果我不包括该行,则计时器不会触发.startTimersomeMethodBeginCalled
如果我呼吁startTimer来自viewDidLoad例如,我可以删除NSRunLoop线和计时器将每隔60秒射击.
嗨我希望指出正确的方向解决一个问题,当iphone的方向正在改变/改变需要在didUpdateHeading上执行的转换:newHeading使CLHeading.trueHeading的值旋转到始终作为如果手机处于CLDeviceOrientationLandscapeRight的方向.
谢谢
在为iphone编写游戏时,我对最好的方法感到困惑.游戏将使用OpenGL渲染,但在创建"开始"屏幕,"菜单","高分"页面等时非常好奇.您是使用OpenGL完成所有这些操作还是创建其他UIView并使用UIKit?
题:
((lambda (x y) (x y)) (lambda (x) (* x x)) (* 3 3))
Run Code Online (Sandbox Code Playgroud)
这是中期的第一名,我把"81 9"他认为我忘了越过一个法律,所以我划掉81,然后他去了.无论如何,我不明白为什么它是81.
我理解为什么(lambda (x) (* x x)) (* 3 3) = 81,但第一个lambda我不明白x和y值是什么,以及它的[body] (x y)作用.
所以我希望有人可以向我解释为什么第一部分似乎没有做任何事情.