我很清楚这是一个简单的问题.我想学习如何在用户选择CGRect/UIButton时将其移动到屏幕上的其他位置.感谢您的帮助.
- (void)showMeSomeButtons:(CGRect)frame{
button = [[UIButton alloc] initWithFrame:frame];
button.frame = CGRectMake(240, 150, 50, 50);
UIImage *buttonGraphic = [UIImage imageNamed:@"1.png"];
[button setBackgroundImage:buttonGraphic forState:UIControlStateNormal];
[button addTarget:self.viewController action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:button];
}
-(void)buttonClicked{
???
}
Run Code Online (Sandbox Code Playgroud) 我正在使用我发现的教程中的NSDictionary,但我只是有一个简单的问题,为什么按字母顺序排序?
NSArray *array = [[NSArray alloc] initWithObjects:userName, nil];
NSArray *array2 = [[NSArray alloc] initWithObjects:@"Other Data", @"Second Entry", nil];
NSDictionary *temp =[[NSDictionary alloc] initWithObjectsAndKeys:array, @"Name", array2, @"A",nil];
self.sortedKeys =[[temp allKeys] sortedArrayUsingSelector:@selector(compare:)];
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助.
在coredata中,我可以很好地与一个实体合作,主要是因为它很好地记录在互联网上.然而,当我找到关系时,我会一遍又一遍地找到相同的数据,告诉我如何向实体添加一个和最佳实践,但在给我实际可用的示例时却不尽如人意.
事实上,我有一对多(实体之间:Name和ErgTimes)关系设置,我想知道如何为每个名称添加多个对象Times.我的Name.m文件里面有
- (void)addTimesObject:(ErgTimes *)value;
Run Code Online (Sandbox Code Playgroud)
但我不知道我应该在哪里使用它来添加时间.
很抱歉这个例子中缺少代码,但是如果有人可以指向一个显示关系使用的教程,那么我可以得到一个非常棒的想法.
-詹姆士.
当我做下面的事情时,我得到一个错误说
for (UIView* att in bottomAttachments) {
if (i <= [cells count]) {
att = [[UIView alloc] extraStuff]
}
}
Run Code Online (Sandbox Code Playgroud)
Fast Enumeration variables cannot be modified in ARC: declare __strong
我__strong该做什么以及为什么要添加它?
我有一个使用coredata的项目,我正在努力删除我存储的内容.但我一直得到这个错误.
An NSManagedObjectContext cannot delete objects in other contexts.
Run Code Online (Sandbox Code Playgroud)
我看着苹果必须说什么,从我能说出来我知道它是正确的,但有些东西仍然没有.有什么建议?谢谢!
for (UserNumber *info in pinNumberArray) {
NSSet *time = [[NSSet alloc] initWithSet:info.Times];
for (ErgTimes *ergTimes in time){
NSMutableArray *temp = [[NSMutableArray alloc] initWithObjects:ergTimes.Twok, nil];
NSManagedObject *eventToDelete = [temp objectAtIndex:0];
[managedObjectContext deleteObject:eventToDelete];
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个NSString这样的东西:
4434332124
我怎么能把它变成这样的东西?
443-433-2124
我一直在使用以下代码遍历我的子视图中的特定类.
for (int i = 0; i < [[self.view subviews] count]; i++) {
if ([[self.view.subviews objectAtIndex:i] class] == [UIButton class]) {
}
}
Run Code Online (Sandbox Code Playgroud)
但我觉得应该有更好的方法.有人可以帮帮我吗?
谢谢.
所以我一直在努力让我的iphone应用程序获得批准.而且,当我对我的一些代码进行一些横冲直撞时,我会说.
在我的剪切愚蠢中,我想也许我不需要SenTestingKit.framework.所以我试图将它从我的程序中删除,当被问及我是否要删除或删除引用时,我意外地点击了删除.
然而,在审查一些崩溃日志PRE-Deletion SenTestingKit.framework时,我发现以下内容......

在我删除框架之前,这个错误再次出现了.这个崩溃代码是0xe7ffdefe
有人可以告诉我在哪里可以获得sentestingkit.framework吗?而且,如果你有任何原因导致崩溃,那将是如此惊人的听到.
谢谢!!!
以下内容是否会导致内存泄漏,或者可以以某种方式将其更改为更好吗?随着countDownTimer = nil被移除
-(void)viewDidLoad{
countDownTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(loadNewTime:) userInfo:nil repeats:YES];
}
-(void)pauseTimer{
NSLog(@"Fired");
[countDownTimer invalidate];
//countDownTimer = nil <------ Causes crash when run
}
-(void)resumeTimer{
countDownTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(loadNewTime:) userInfo:nil repeats:YES];
}
Run Code Online (Sandbox Code Playgroud) 我想写这样的东西,但我不知道如何.
for(int i = 0; i < ( the greater value between intA and intB ); i++)
Run Code Online (Sandbox Code Playgroud) objective-c ×10
ios ×7
xcode ×7
iphone ×4
cocoa-touch ×3
core-data ×2
nsstring ×1
nstimer ×1
uiview ×1