cocoa-touch

How do I fade in /out a rectangle or text?

霸气de小男生 提交于 2019-12-30 03:26:10
问题 I want to achieve the effect of fade in / fade out the rect or text. I call CGContextFillRect or CGContextShowText in my UIVIew's drawRect: method. I wonder if there is a way to achieve the animation without using UIView' support(i.e. [UIView beginAnimations::]. The desired effect I want to achieve is similar to what in Microsoft's bing serach engine, like those small black squares fade in/ fade out as you move around the web page. Thanks in advance! 回答1: Why do you not want to use UIView's

iPhone subview design (UIView vs UIViewController)

♀尐吖头ヾ 提交于 2019-12-30 03:26:06
问题 I'm designing a simple Quiz application. The application needs to display different types of QuizQuestions. Each type of QuizQuestion has a distinct behavior and UI. The user interface will be something like this: alt text http://dl.getdropbox.com/u/907284/Picture%201.png I would like to be able to design each type of QuizQuestion in Interface Builder. For example, a MultipleChoiceQuizQuestion would look like this: alt text http://dl.getdropbox.com/u/907284/Picture%202.png Originally, I

How to highlight a row in a UITableView

ε祈祈猫儿з 提交于 2019-12-30 03:06:19
问题 The code below seems to have no effect. I want it to be highlighed in the same way it highlights when you tap on a row - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ... [cell.textLabel setHighlighted:YES]; return cell; } 回答1: This line will handle repainting the cell, label and accessory for you: [tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; 回答2: As others have noted, you can

Changing UIPickerView row height

前提是你 提交于 2019-12-30 03:02:39
问题 I'm working on a program for a class I'm taking and part of the program requires a UIPickerView with images in it. I have the picker up and running, but the height of the rows in the picker are still too small, causing the images (100x100) to overlap. I'm looking for a way to change the UIPickerView so that the images will fit in one row, without overlapping. Thanks 回答1: In the documentation for the UIPickerView, you have a link to the UIPickerViewDelegate protocol. There is a method that you

UITableViewHeaderFooterView subclass with auto layout and section reloading won't work well together

心已入冬 提交于 2019-12-30 02:43:11
问题 I am trying to incorporate auto layout into my UITableViewHeaderFooterView subclass. The class is pretty basic, just two labels. This is the complete subclass: @implementation MBTableDetailStyleFooterView static void MBTableDetailStyleFooterViewCommonSetup(MBTableDetailStyleFooterView *_self) { UILabel *rightLabel = [[UILabel alloc] init]; _self.rightLabel = rightLabel; rightLabel.translatesAutoresizingMaskIntoConstraints = NO; [_self.contentView addSubview:rightLabel]; UILabel *leftLabel = [

How do I get arctan MATH function in iOS?

泪湿孤枕 提交于 2019-12-30 02:42:19
问题 How do I get arctan MATH function in iphone SDK? 回答1: The function you are looking for is atan(double) 回答2: Use the "2nd"-function under the "("-key, top left with the iphone in horizontal position. The tan key will change to tan-1, i.e. arctan. 来源: https://stackoverflow.com/questions/5339595/how-do-i-get-arctan-math-function-in-ios

Transitioning UINavigationBar colors?

℡╲_俬逩灬. 提交于 2019-12-30 02:29:05
问题 I'm basically trying to duplicate the behavior of the iPod app on the iPhone, where when you select a song, the music player view slides in, and the navigation bar transitions to a new color. My app is set up as a tabbed based application, with UITabBarController and a nested UINavigationController in each tab. Inside each UINavigationController for each tab is a UITableView. When I select an item in the table, I'm using pushViewController to slide to the next view, and I've set

How to stretch the image size in iphone UIImage or UIImageView

ぃ、小莉子 提交于 2019-12-30 02:16:29
问题 I'd like to show an image in an iPhone app, but the image I'm using is too big. I'd like to scale it to fit the iPhone screen, I can't find any class to handle it. 回答1: UIImageView* view = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"your_image.png"]]; view.frame = CGRectMake(0, 0, width, height); To get the frame of the iPhone screen you can use CGRect frame = [[UIScreen mainScreen] bounds]; 回答2: In Interface Builder, select your UIImageView. From the Tools menu, select

Xcode 7, Obj-C, “Null passed to a callee that requires a non-null argument”

你。 提交于 2019-12-30 01:41:18
问题 In Xcode 7, I'm getting this warning: Null passed to a callee that requires a non-null argument .. from this nil initialization of a NSMutableArray... sectionTitles = [[NSMutableArray alloc] initWithObjects:nil]; I've found that I should be using removeAllObjects instead. [sectionTitles removeAllObjects]; However, this doesn't allow me to evaluate a sectionTitles.count == 0 . I did try sectionTitles == nil , however unless I use iniWithObjects I can't add objects later on. I need to set the

Adding Emboss to a UILabel in a navigationItem.titleView (as seen with navigationItem.title)

亡梦爱人 提交于 2019-12-30 01:39:05
问题 I'm trying to mimic the default emboss that automatically gets applied to navigationItem.title, as well as many other UIKit controls. As seen in this screenshot's title ("Table Cells"): Emboss title http://quicksnapper.com/files/3440/192219267049D92BB23DE74.png I'm essentially trying to add 2 UILabels to the navigationItem.titleView, however the UILabels just show up as flatly drawn and it really just doesn't feel/look right :P I've thought about playing with shadows, but that would only give