小编Jam*_*nay的帖子

基本Objective-C数组'for'循环辅助

所以继续我的挂断,我创建一个数组,将按钮传递到它并使用for循环试图将每个按钮放在视图上.我知道他们将处于相同的位置,因为他们都经历了相同的CGRectMake.但是我似乎无法在屏幕上放置任何代码,尽管它没有返回任何错误,但仍然让我难以理解为什么.

有人有什么建议吗?谢谢!

- (void)practiceMethod{

 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Practice Method has begun" message:@"Alert" delegate: self cancelButtonTitle:@"Close" otherButtonTitles: nil];
 //[alert show];
 [alert release];

 float i=0;

 CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];

 UIImage *buttonGraphic = [UIImage imageNamed:@"1.png"];

 UIButton *buttonOne = [[UIButton alloc] initWithFrame:applicationFrame];
 UIButton *buttonTwo = [[UIButton alloc] initWithFrame:applicationFrame];

 buttonArray = [[NSArray alloc] initWithObjects:buttonOne, buttonTwo,nil];

 for (i = 0; i > [buttonArray count]; i++) {

  UIButton *tempElement = [buttonArray objectAtIndex:i];

  tempElement.frame = CGRectMake(140, 230, 50, 50);

  [tempElement setBackgroundImage:buttonGraphic forState:UIControlStateNormal];

  [self addSubview:tempElement]; …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c

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

核心数据编辑属性

所以我对核心数据非常新,但是我经历了一个教程并且非常了解它,至少是大多数事情背后的想法.但我还有一个问题,我无法找到任何地方.看起来很简单,但现在就是这样.如果我在一个实体中有两个字符串,我们可以说:

1.name
2.position

如果已输入名称,我如何允许用户在textField中输入文本并在以后将其分配到其位置?即使有20个名字,考虑没有重复?

我以为它可能是这样的......但它似乎没有用.

UserInfo *userInfo = (UserNumber *)[NSEntityDescription insertNewObjectForEntityForName:@"UserInfo" inManagedObjectContext:managedObjectContext];

if ([userName isEqualToString:"@James"]) {
    userInfo.Position = nameField.text;
}
Run Code Online (Sandbox Code Playgroud)

iphone xcode core-data objective-c

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

iPad游戏:Objective-C太慢了(与普通C相比)?

我开始为iPad设计一款新游戏,我发了一篇文章说我应该用C而不是Objective-c来编写游戏,因为Objective-c太慢了.

任何人都可以评论这个吗?我不知道C或C++,但我想找到开发这个游戏的最佳方法.

谢谢!

c objective-c ios

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

比较objective-c中的两个字符串会导致app退出

我试图使用"isEqualToString"比较两个字符串,我似乎无法让它工作.一旦它开始运行if语句,它就会退出应用程序.我很确定这些琴弦实际上是相互平等的,尽管我最好的尝试,我仍然没有想法.任何帮助,将不胜感激.

-(void)createTextfields{
    name = [[UITextField alloc] initWithFrame:CGRectMake(10, 0, 140, 25)];
    name.borderStyle = UITextBorderStyleRoundedRect;
    name.textColor = [UIColor blackColor];
    name.placeholder = @"Password";
    name.textAlignment = UITextAlignmentCenter;
    [self addSubview:name];

    entry = [[UITextField alloc] initWithFrame:CGRectMake(170, 0, 140, 25)];
    entry.borderStyle = UITextBorderStyleLine;
    entry.textColor = [UIColor blueColor];
    entry.textAlignment = UITextAlignmentCenter;
    [self addSubview:entry];
}

-(void)createSubmitButton{
    UIButton *submit = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    submit.titleLabel.textAlignment = UITextAlignmentCenter;
    [submit setTitle:@"Submit" forState:UIControlStateNormal];
    submit.frame = CGRectMake(90, 50, 60, 30);
    [submit addTarget:self action:@selector(runSubmit) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:submit];


    UIButton *savePass = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    savePass.titleLabel.textAlignment = UITextAlignmentCenter;
    [savePass setTitle:@"Save" …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c

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

简单'if'with'或'声明

我无法弄清楚为什么这不起作用......

if (index != 10 || index != 0) {                
Run Code Online (Sandbox Code Playgroud)

如果index = 0仍然允许该功能,为什么?

javascript jquery

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

标签 统计

objective-c ×4

iphone ×3

xcode ×3

c ×1

core-data ×1

ios ×1

javascript ×1

jquery ×1