Tag: 用户界面

用于不同屏幕尺寸的UI的图像大小?

如果我想在使用自动布局的应用程序的iOS中设置button的背景图像,那么.png图像应该是多大? 由于button的高度和宽度总是会变化的,除了适应视网膜/非屏幕显示(@ 2x?)之外。

定制UIActionSheet

我想知道如何去定制像这样的UIActionSheet: 当你按下button来使这个视图,它确实出现像UIActionSheet但老实说,我不太确定他们没有使用某种自定义animation与包含两个button的UIView。 有没有人可以谈论我如何去做这件事?

在presentViewController之后,模态viewcontroller UI没有响应:animated:completion:

我的应用程序有一个根视图控制器,在应用程序的开始显示 loginviewController视图,如果用户没有login 主viewController视图,如果用户login AppDelegate代码: – (BOOL) application: (UIApplication*) application didFinishLaunchingWithOptions: (NSDictionary*) launchOptions { self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; self.window.rootViewController = [[RootViewController alloc] init]; [self.window makeKeyAndVisible]; return YES; } 以下是RootViewController中使用的代码: @implementation RootViewController – (void) loadView { [super loadView]; // here mainViewController and loginNavigationController are initialized } … – (UIView*) view { [super view]; […]

如果通过performSelectorInBackground控制UI,会发生什么情况?

我读了一些信息,UI界面只在MainThread上更新。 我需要asynchronous更新一些UIButton的,所以我使用performSelectorInBackground ,它在模拟器和设备(iPad4)上工作正常。 [self performSelectorInBackground:@selector(toggleToUpperWhenSingleShift) withObject:nil]; – (void)toggleToUpperWhenSingleShift{ shiftStateIndicator = 1; for (UIView *aPad in self.subviews) { if ( [aPad isKindOfClass:[UIButton class]] ) { UIButton *aButPad = (UIButton *)aPad; NSMutableString *currentTitle = [NSMutableString stringWithString:[aButPad titleForState:UIControlStateNormal]]; NSString *firstChar = [currentTitle substringToIndex:1]; [currentTitle replaceCharactersInRange:NSMakeRange(0, 1) withString:[firstChar uppercaseString]]; [aButPad setTitle:currentTitle forState:UIControlStateNormal]; [aButPad setTitle:currentTitle forState:UIControlStateHighlighted]; currentTitle = [NSMutableString stringWithString:[aButPad […]

在栈视图内创buildUilabels之间的垂直线

我想在代码中创build一个自定义标题的UICollectionView。 因此,我创build了UICollectionViewCell的子类来描述我的自定义标题。 我想在水平线的头部显示五个标签。 所以我创build了五个标签并将它们添加到一个stackView中。 stackview显示我的标签平等填充。 到目前为止一切都完美 标签1标签2标签3标签4标签5 //Label 1 let votesLabel: UILabel = { let label = UILabel() let attributedText = NSMutableAttributedString(string: "Votes", attributes: [NSFontAttributeName: UIFont.boldSystemFont(ofSize: 12) ]) attributedText.append(NSAttributedString(string: "\n 0", attributes: [NSForegroundColorAttributeName: UIColor.lightGray, NSFontAttributeName: UIFont.systemFont(ofSize: 14)])) label.attributedText = attributedText // label.text = "11\nvotes" label.textAlignment = .center label.numberOfLines = 0 return label }() // label […]

对于更便宜的颜色:UIView或UIImage

假设在你的UIdevise中,你需要一个纯色的矩形。 当然你可以使用一个UIImageView对象并将其挂接到一个图像上,但是在某些情况下,放入一个UIView并设置背景颜色可能会更快更容易。 我的问题是在内存和性能方面哪个更便宜。 我的直觉是,一个空的UIView比一个图像更容易渲染,该图像的文件必须加载,位存储在内存中。 任何人都可以对此说话吗? 非常感谢!

我怎样才能覆盖search栏的MapKit?

我怎样才能覆盖search栏的MapKit? 我喜欢新的Google地图应用程序有一个search框和hover在地图上的button。 看左边的图片: 我不知道如何得到这个,因为我还没有编程iOS超过几个星期。 任何关于如何将UI元素hover在Storyboard / Objective-C上的想法? 据推测,这是一个导航栏已被隐藏,但是这是如何做的,它是如何出现在它下面的地图?

NSTextContainer的usedRectForTextContainer返回不正确的高度

我试图得到所需矩形的大小显示给定的文本容器中的文本与下面的代码: s = [manager usedRectForTextContainer:container].size; 我期望文本是在多行中,但是在行的末尾切断并且不显示下一行中的内容。 只有当有一些额外的字符时才会发生这种情况; 在大约60个字符的行中,下一行将显示10或15左右的剩余,但是不显示。 这可能是一个插入问题? 也许文字包装? 我真的不确定,因为我是iOS和UI编程的新手。 编辑:在上面的代码中,manager是一个NSLayoutManager ,而容器是一个NSTextContainer 。 我敢肯定,这是输出这个问题,因为在这个函数调用之后,如果我将s的值更改为我所期望的值,我将显示整个string的预期布局。 有关布局pipe理器的信息是 <NSLayoutManager: 0xd203f60> 1 containers, text backing has 140 characters Currently holding 140 glyphs. Glyph tree contents: 140 characters, 140 glyphs, 1 nodes, 32 node bytes, 384 storage bytes, 416 total bytes, 2.97 bytes per character, 2.97 bytes per glyph […]

在所有选项卡(UITabBarController)中都有一个可见的视图

我怎样才能有一个单一的视图(UIButton)在UITabViewController的所有选项卡中可见? 例如,我需要在所有选项卡中保留一个“信息”button,而不是将其添加到所有选项卡的XIB,并且不要在所有选项卡中重写重复的代码。

绘制backgroundcolor&边框与背景PNGs

我想为我的iPad应用程序的大多数button特定的RGBhex颜色。 我所做的是:我已经在我的项目中实现了UIButton子类,它模拟所需的背景颜色,文本颜色和button边框 – 然后我在我需要UIButton项目中随处使用它。 我的用户界面/用户体验devise师不提供PNG,他坚持我模仿相同颜色的网站button有hex代码。 我更多的是一个背景PNG的球迷。 现在,这个问题与编程的关系,你可能想知道的是,我正在访问.layer.borderWidth & .layer.borderColor属性,这个属性最终被无处不在使用。 那么,这种方法是否对应用程序有所帮​​助,而不是使用背景PNG? 注意 (如果相关) :所有button的大小相同。