更改 FireMonkey iOS 应用程序中 TLabel 的颜色,并将项目添加到 TStringGrid?
在 XE-script-prep(创建 Xcode 文件夹)之后,我设法让 Xcode(在 Windows 下作为虚拟机运行)将 XE2 构建的 FireMonkey iOS HD 应用程序推送到我的(越狱的)iPhone,并具有有效的公司证书。
不管怎样,伪造原生的 cocoa 控件似乎有点肮脏,但是粘上一个 TToolbar(带有标准 iPhone 渐变的面板)、几个 TSpeedButton(其中有这个奇怪的 V 斜率的东西)和一个 TStringGrid,你就几乎在基本 iPhone 应用程序设计领域。
将 TLabel 放在 TToolbar 上作为标题,您会立即想要更改颜色,但似乎没有相应的属性。是的,但现在我听到你说,这都是样式(TLayout)驱动的,这就是我的想法,但是样式编辑器在样式设计器的 TLayout 或 TText 方面没有颜色(颜色!?)属性。
第二个问题也同样快,我在上面放了一个 TStringGrid 并认为我会动态设置行,所以我创建了一个字符串列,将 RowCount 设置为 6,然后设置
Cells[1, n] := 'Row ' + IntToStr(iLoop);
...没有效果(我还尝试了 Cells[0, n],以防它是从零开始的列表)。
我要疯了吗?
仍然对连接感到困惑(你如何与 iPhone 之外的任何东西对话!?),并且在 iPhone 4 上使用 TFloatAnimation 旋转 48x48 图像的性能坦率地说是令人震惊的。但我很乐观,我们已经走到这一步了!
I managed to get Xcode (running as a VM under Windows) pushing an XE2 build FireMonkey iOS HD app to my (jailbroken) iPhone after XE-script-prep (creating the Xcode folder), with a valid company certificate.
Anyway, faking the native cocoa controls seems a little seedy, but sticking a TToolbar (panel with standard iPhone gradient), a couple of TSpeedButtons (which have this curious V slope thing going on), and a TStringGrid and you're almost in the realms of basic iPhone app design.
Drop a TLabel on the TToolbar for a caption and straight away you'll want to change the colour, which there doesnt appear to be a property for. Yeah but it's all style (TLayout) driven now I hear you say, which is what I thought, but the style editor doesnt have a colour (color!?) property within TLayout or TText aspects of the Style Designer.
Shoe-horning a second question which is just as quick, I dropped a TStringGrid on there and thought I'd dynamically set the rows, so I created a string column, set the RowCount to 6, then set the
Cells[1, n] := 'Row ' + IntToStr(iLoop);
...with no effect (I also tried Cells[0, n], in case it was a zero-based list).
Am I going mad?
Still stumped on connectivity (how do you talk to anything outside the iPhone!?), and the performance of spinning a 48x48 image with a TFloatAnimation on an iPhone 4 was quite frankly appalling. But I'm optimistic, we've got this far!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这对我来说效果很好。
我注意到你有
n
和iLoop
哪一个是循环变量?至于颜色设置 Roberts 答案在设计时有效,如果您想在代码中设置它,您可以使用
Label1.FontFill.Color := TAlphaColorRec.Beige;
更好的方法。
但我认为正确的方法是为 FontFill 提供一个 setter 函数,例如:
This works fine for me.
I noticed you had both
n
andiLoop
wich one was the loop variable?As to the color setting Roberts answer works designtime, if you want to set it in code you can do
Label1.FontFill.Color := TAlphaColorRec.Beige;
better way.
But I think the correct approach would be to give FontFill a setter function like:
要更改标签的颜色,您需要使用样式。
右键单击组件并选择“编辑|自定义样式...”,
然后展开“布局”以查找并选择 TText
,然后调整“填充”属性以更改颜色。
To change the color of a Label you need to use the Style.
Right Click on the Component and select Edit|Custom Style...
Then expand the Tlayout to find and select the TText
Then adjust the
Fill
Property to change the color.