在XCode 4.0.2中,有一种很好的方法可以在Build Settings单击"Levels"格式时配置程序.喜欢这个屏幕

级别是这样的:
所以XCode看看是否Target有配置,如果没有看到project,如果没有使用iOS default.
这里的问题是,当您将配置设置为低级别而不是删除它时,不可能使用较高级别的配置.
喜欢在图像中.我将所有的目标,以使用Google在Current Project Version,但在这个目标我想用它stackOverflow和它的工作.但在另一个Generated Versioning ...我首先配置stackOverflow但改变我的想法,并希望使用Project Settings.现在是不可能删除Target Settings,我将不得不手动输入它.
如何删除目标设置以使用项目设置?
我发现了一件事.如果我设置肯定功能
- textField:shouldChangeCharactersInRange:replacementString:
Run Code Online (Sandbox Code Playgroud)
光标停留在我输入的相同位置,如("|"=光标)
"|" => Empty , type a
"a|" => type b
"ab|" => change cursor
"a|b" => type c
"ac|b" => type d
"acd|b" => change cursor
"ac|db" => type backspace
"a|db" => type backspace again
"|db" => *result*
Run Code Online (Sandbox Code Playgroud)
但是,如果我必须更改文本,比如放入"-"倒数第二个字符,我会做逻辑事情并设置文本:
[textField setText:newText];
Run Code Online (Sandbox Code Playgroud)
但上面的示例将采用以下方式:
"|" => Empty , type a
"a|" => type b (put character "-" automatic)
"a-b|" => user change cursor
"a|-b" => type c
"ac-b|" => type d ## the cursor is in …Run Code Online (Sandbox Code Playgroud) 它很容易改变UISegmentedControl的颜色.我发现各种解决方案像这样,本网站和最好的这一解决方案.但没有一个是我想要的.
我尝试创建一个简单的东西,它很容易,这是我的代码:(我使用的是iOS 4.2,而不是5.0和xcode 4.0.2)
id segment[3];
UISegmentedControl *segmentedControl;
- (id)init
{
NSArray *itens = [NSArray arrayWithObjects: @"Option 1", @"Option 2", @"Option 3", nil];
segmentedControl = [[UISegmentedControl alloc] initWithItems:itens];
[segmentedControl setFrame:CGRectMake(0, 0, 500, 30)];
[segmentedControl setSegmentedControlStyle:UISegmentedControlStyleBar];
[segmentedControl addTarget:self
action:@selector(segmentedControl:)
forControlEvents:UIControlEventAllEvents];
switch (type) {
case type1: [segmentedControl setSelectedSegmentIndex:0]; break;
case type2: [segmentedControl setSelectedSegmentIndex:1]; break;
case type3: [segmentedControl setSelectedSegmentIndex:2]; break;
}
for (int i=0; i<3; i++) {
//The most important trick to work, have to retain the …Run Code Online (Sandbox Code Playgroud) 我正在使用复杂的字典,并希望只需为其分配一个变量即可轻松工作。
myDictionay["with"]["complex"]["sub"]["dictionary"] = "NewValue"
Run Code Online (Sandbox Code Playgroud)
我只想要这个:
let smaller = myDictionay["with"]["complex"]["sub"]
smaller["dictionary"] = "NewValue"
Run Code Online (Sandbox Code Playgroud)
我该怎么做?
在这三种情况下我会有内存泄漏吗?
没有__strong,没有设置为nil
- (void)function {
NSString *string = [[NSString alloc] initWithString: @"Hello World"];
}
Run Code Online (Sandbox Code Playgroud)没有设置为nil但使用__strong
- (void)function {
__strong NSString *string = [[NSString alloc] initWithString: @"Hello World"];
}
Run Code Online (Sandbox Code Playgroud)没有__strong但是设置为nil
- (void)function {
NSString *string = [[NSString alloc] initWithString: @"Hello World"];
string = nil;
}
Run Code Online (Sandbox Code Playgroud)使用自动引用计数(ARC),如果我没有设置任何关键字,我假设变量是__strong?
有没有一种简单的方法来隐藏它?我使用用户位置,但我不想显示蓝点.我怎么能隐藏它?
- 编辑 -
我用错了什么?
@interface ALMapaViewController : UIViewController <MKMapViewDelegate,
MKAnnotation>
{
IBOutlet MKMapView *mapaPrincipal;
id<ALMapaViewControllerDelegate> delegateMap;
CLLocationCoordinate2D coordinate;
}
Run Code Online (Sandbox Code Playgroud)
我的.m
@implementation ALMapaViewController
- (void)viewDidLoad{
[super viewDidLoad];
[mapaPrincipal setMapType:MKMapTypeStandard];
[mapaPrincipal setZoomEnabled:YES];
[mapaPrincipal setScrollEnabled:YES];
[mapaPrincipal.userLocation addObserver:self
forKeyPath:@"location"
options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld)
context:nil];
[mapaPrincipal setShowsUserLocation:YES];
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
MKCoordinateRegion region;
region.center = mapaPrincipal.userLocation.coordinate;
MKCoordinateSpan span;
span.latitudeDelta = 0.005f;
span.longitudeDelta = 0.005f;
region.span = span;
[mapaPrincipal setRegion:region animated:YES];
self.coordinate = region.center;
[mapaPrincipal addAnnotation:self];
[mapaPrincipal setShowsUserLocation:NO];
}
@end
Run Code Online (Sandbox Code Playgroud)
我已经使用了showUserLocation它,它仍然显示蓝点.
我试图替换"<br>"为"\n"但是没有找到如何使用<>和tr.任何想要执行此命令的工作:
echo "HTML example<br>Print new line<br>please<br>not work" | tr "<br>" "\n"
Run Code Online (Sandbox Code Playgroud)
编辑
该FatalError回答没有为我的OSX狮子工作.我不知道为什么,但这个简单的sed命令不会创建新行,它只返回
HTML examplenPrint new linenpleasennot work
Run Code Online (Sandbox Code Playgroud)
我正在使用GNU bash,版本3.2.48(1)-release(x86_64-apple-darwin11).还有其他想法吗?
我是Git的新手.我真的很讨厌使用命令行,所以我使用的是SmartGit.
我有一些关于git阶段的新手问题.
stage -> commit -> synchronize.使用本地提交,我有文件的历史记录.但是,有了舞台,我没有它?像这种情况使用:
如果我们按ctrl+ command+,up arrow我们会在文件代码和标题代码之间切换.(.m到.h)
如果我们按ctrl+ command+ j或command+,mouse click我们跳转到变量的定义.但它不适用于超级.
那么,有一种快速的方法吗?
我有这种情况:
- (void) foo {
NSLog(@"Print this: %@", [MyObject classString]);
}
// So in MyObject.m I do
@implementation MyObject
+ (NSString *) classString {
return [OtherObject otherClassString]; //The Warning "Potential leak..." is for this line
}
@end
// Finally in OtherObject
@implementation OtherObject
+ (NSString *) otherClassString {
NSString *result = [[NSString alloc] initWithString:@"Hello World"];
return result;
}
@end
Run Code Online (Sandbox Code Playgroud)
一开始,我对这项工作有一个警告otherClassString,classString但是otherClassString这样做.
现在我的问题是classString在MyObject.我尝试了很多东西,但这个警告总是显示出来.我不能在类方法中调用类方法吗?
objective-c ×4
ios ×3
xcode ×2
xcode4 ×2
bash ×1
class ×1
class-method ×1
cocoa-touch ×1
dictionary ×1
git ×1
ipad ×1
iphone ×1
memory-leaks ×1
mkannotation ×1
mkmapview ×1
swift ×1
uitextfield ×1