小编Joo*_*ark的帖子

在UILabel中更改动画文本

I'm setting a new text value to a UILabel. Currently, the new text appears just fine. However, I'd like to add some animation when the new text appears. I'm wondering what I can do to animate the appearance of the new text.

objective-c uilabel ipad caanimation ios

119
推荐指数
8
解决办法
8万
查看次数

自动释放或不自动释放

在"核心数据编程指南"的以下代码示例中,NSFetchRequest是使用自动释放创建的,而NSSortDescriptor不是使用自动释放创建的.为什么不使用autorelease创建NSSortDescriptor?这是一个偏好的问题吗?

NSManagedObjectContext *moc = [self managedObjectContext];    
NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"Employee" 
                                                     inManagedObjectContext:moc];

NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity:entityDescription];
// Set example predicate and sort orderings...
NSNumber *minimumSalary = ...;
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(lastName LIKE[c]'Worsley') AND (salary > %@)", minimumSalary];    
[request setPredicate:predicate];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"firstName" 
                                                               ascending:YES];
[request setSortDescriptors:[NSArray arrayWithObject:sortDescriptor]];
[sortDescriptor release];
NSError *error;
NSArray *array = [moc executeFetchRequest:request error:&error];
if (array == nil){
    // Deal with error...
}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c

12
推荐指数
2
解决办法
1983
查看次数

UIScreen绑定与applicationFrame

为什么我在Apple的一些示例代码(例如PhotoScroller)中看到我应该执行以下操作loadView:

CGRect frame = [[UIScreen mainScreen] bounds]; 
Run Code Online (Sandbox Code Playgroud)

代替

CGRect frame = [[UIScreen mainScreen] applicationFrame]; 
Run Code Online (Sandbox Code Playgroud)

获得主屏幕的框架是否有所不同?

cocoa-touch ios uiscreen

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

UITableViewCell不使用弃用方法initWithFrame:reuseIdentifier

我已经阅读了Loren关于为UITableViewCell绘制自己内容的文章.但是,他使用的是不推荐使用的方法:initWithFrame:reuseIdentifier:在UITableViewCell上已弃用.

如何在不使用的情况下让他的榜样上班initWithFrame:reuseIdentifier

uitableview ios

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

iphone内存使用

有没有办法nslog你的应用程序当前使用多少内存?

iphone

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

sql语句到表达式树

我想知道如何将sql字符串转换为表达式树.目前,在Linq to SQL中,表达式树被转换为sql语句.怎么走另一条路?你会怎么翻译?

select * from books where bookname like '%The%' and year > 2008 
Run Code Online (Sandbox Code Playgroud)

进入c#中的表达式树?

c# expression-trees

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

UIButton的自定义图像和框架

我有以下代码.

  UIImage *cancelImg = [UIImage imageNamed:@"cancel.jpeg"]; 
  UIButton *btnCancel = [UIButton buttonWithType:UIButtonTypeCustom];
  btnCancel.userInteractionEnabled = YES;
  [btnCancel setFrame:CGRectMake(0.0,0.0, 28.0, 28.0)];
  [btnCancel setImage:cancelImg forState:UIControlStateNormal];
  cell.accessoryView  = btnCancel;
Run Code Online (Sandbox Code Playgroud)

cancel.jpeg目前大于28 x 28,实际上是100 x 100.

当我将UIButton的尺寸设置为28 x 28时,为什么按钮会显示100 x 100尺寸的图像?

iphone uibutton

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

为什么typedef与enum类型一起使用?

为什么在下面的代码中需要typedef?

typedef enum _Coordinate {
    CoordinateX = 0,    ///< X axis
    CoordinateY = 1,    ///< Y axis
    CPCoordinateZ = 2   ///< Z axis
} Coordinate;
Run Code Online (Sandbox Code Playgroud)

为什么不只是下面的代码并删除typedef?

enum Coordinate {
    CoordinateX = 0,    ///< X axis
    CoordinateY = 1,    ///< Y axis
    CPCoordinateZ = 2   ///< Z axis
};
Run Code Online (Sandbox Code Playgroud)

c enums typedef objective-c

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

核心数据和分页

我有一个包含50,000条记录的数据库.我正在使用核心数据来从搜索中获取记录.搜索可以轻松返回1000条记录.使用核心数据和uitableview来浏览这些记录需要什么?我希望一次显示100条记录,并在查看100条记录后"加载更多"按钮.

core-data nsfetchrequest

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

UIViewController的loadView方法

当覆盖UIViewController中的loadView方法时,是否应该在方法的开头或方法的末尾调用[super loadView]?为什么?

iphone uiviewcontroller

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

objective-c代码格式化

格式化这段代码的好方法是什么?

UIBarButtonItem *prev = [[UIBarButtonItem alloc] initWithTitle:@"Prev"
                        style:UIBarButtonItemStyleBordered
                        target:self
                        action:@selector(setDateRangeClicked:)];
Run Code Online (Sandbox Code Playgroud)

objective-c

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

viewWithTag并在层次结构内深处检索视图

如果我有以下视图层次结构

UIView ---顶级视图
--UIButton
--UIView
---- UILabel
---- UILabel - tag = 1

如何从顶层视图的引用中获取带标记1的UILabel?

iphone uiview

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

用linq取出foreach

有没有办法在linq中的以下代码中取出foreach但产生相同的输出?

    DropDownList ddl = new DropDownList();
    foreach (DataRow row in ds.Tables[0].Rows)
    {
        if ((byte)row["ListTypeID"] == 0)
        {
            item = new ListItem(row["ListText"].ToString(), string.Format("{0}:{1}", row["ListTypeID"].ToString(), row["ListID"].ToString()));
            ddl.Items.Add(item);
        }
        else
        {
            item = new ListItem(row["ListText"].ToString(), string.Format("{0}", row["ListID"].ToString()));
            ddl.Items.Add(item);
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# linq

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