frame

How to get the frame of a view inside another view?

杀马特。学长 韩版系。学妹 提交于 2019-11-26 19:19:27
问题 I have an UIImageView in the self.view (the main View) and inside it there is a UIButton . I want to know what's the frame of UIButton in self.view not in UIImageView . 回答1: I guess you are looking for this method – convertRect:toView: // Swift let frame = imageView.convert(button.frame, to: self.view) // Objective-C CGRect frame = [imageView convertRect:button.frame toView:self.view]; 回答2: There are four UIView methods which can help you, converting CGPoints and CGRects from one UIView

Accessing the document object of a frame with JavaScript

不想你离开。 提交于 2019-11-26 17:45:35
问题 I'm testing on this page, and I'm not sure what I'm missing. // Two frames on the page > document.getElementsByTagName("frame").length 2 // Same domain, so no security restrictions > document.getElementsByTagName("frame")[0].src "http://www.quackit.com/html/templates/frames/menu_1.html" > window.location.href "http://www.quackit.com/html/templates/frames/frames_example_1.html" // Can't access the document > document.getElementsByTagName("frame")[0].document undefined It seems like this should

Calculating UILabel Text Size

别来无恙 提交于 2019-11-26 17:23:39
I am drawing UILabels programmatically. They get their sizes from a database. So I cannot just use sizeToFit . I have already implemented a function that redraws UILabels with a passed ratio. So all I need to find is the text in UILabel from my view that would require the maximum ratio to redraw UILabels . So finally I need to do something like this: double ratio = 1.00; for (UILabel* labels in sec.subviews) { float widthLabel = labels.frame.size.width; float heightLabel = labels.frame.size.height; float heightText = //get the text height here float widthText = //get the text width here if

AWT custom rendering - capture smooth resizes and eliminate resize flicker

不想你离开。 提交于 2019-11-26 17:07:36
问题 I've been looking at this for several months and so far this is the best I have come up with. The structure (render outside of EDT) is not up for debate, as our application operates this way and will not be rewritten. The application has a layout model and a scripting model which are integrated and drive rendering, so the render must be performed outside of the AWT paint model. What I am trying to arrive at is the optimal and reliable way to perform custom rendering. The following SSCCE works

Html code as IFRAME source rather than a URL

纵然是瞬间 提交于 2019-11-26 15:56:50
This standard code for an IFRAME, is there a way to replace the src URL with Just html code? so my problem is simple, I have a page it loads an HTML body from MYSQL I want to present that code in a frame so it renders it self independent of the rest of the page and in the confines of that specific bordering. <iframe src="http://example.com" name="test" height="120" width="600">You need a Frames Capable browser to view this content.</iframe> lonesomeday You can do this with a data URL. This includes the entire document in a single string of HTML. For example, the following HTML: <html><body>foo

How to prevent my site page to be loaded via 3rd party site frame of iFrame

我与影子孤独终老i 提交于 2019-11-26 15:50:11
How can I find out that my page is embedded as a frame to other site during page loading? I guess referrer request header can't help me here? Thanks. You cannot check it from the server's side, but you can use javascript to detect it after the page has loaded. Compare top and self , if they're not identical, you are in a frame. Additionally, some modern browsers respect the X-FRAME-OPTIONS header, that can have two values: DENY – prevents the page from being rendered if it is contained in a frame SAMEORIGIN – same as above, unless the page belongs to the same domain as the top-level frameset

Adding label to frame in Tkinter ignores the attributes of frame

[亡魂溺海] 提交于 2019-11-26 14:46:16
问题 I have created a frame of fixed size and now i want to add some labels and other widgets on it. But i observed as soon as i add new widget on this frame its attributes are not honored i.e. size and default back ground color set is not honored. from Tkinter import * tk = Tk() page1 = Frame(tk, bg="blue", width=100, height=200) l1 = Label(page1, text='This is label 1') page1.pack() l1.pack() tk.mainloop() So in the above example if i comment out line 4 & 6, then i can see a frame of fixed size

Can I use setFrame and autolayout on the same view?

試著忘記壹切 提交于 2019-11-26 14:07:17
I want to add padding to all of my buttons, so I subclassed UIButton, and among other changes, I wanted to add a fixed padding by using setFrame method. Everything was working, except for setFrame. I checked around, and I found out that if I uncheck "using AutoLayout" on that view, then I can use setFrame, and it works. Is there a way around this? I really want to use autolayout, because it helps in making the app look nice on both iphone 5 and earlier devices. But I also would like to use setFrame in my subclass, to make my life a litle easier. Summing up, my question is: Can I use autolayout

the images are not loading

走远了吗. 提交于 2019-11-26 13:51:21
The frame window is launching but the background and the foreground images are not loading and the window frame size is also very very small. Please help me to fix the error. here is the code posted Aquarium.java import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import java.util.Vector; public class Aquarium extends Frame implements Runnable { Image aquariumImage,memoryImage; BufferedImage bImage; Graphics memoryGraphics; Image [] fishImages=new Image[2]; MediaTracker tracker; int

Adjust UILabel height to text

淺唱寂寞╮ 提交于 2019-11-26 12:47:30
I have some labels which I want to adjust their height to the text, this is the code I wrote for this now func heightForView(text:String, font:UIFont, width:CGFloat) -> CGFloat{ let label:UILabel = UILabel(frame: CGRectMake(0, 0, width, CGFloat.max)) label.numberOfLines = 0 label.lineBreakMode = NSLineBreakMode.ByWordWrapping label.font = font label.text = text label.sizeToFit() return label.frame.height } EDIT: The issue was not in this piece of code, so my fix is in the question itself. It might still be useful for others! Anorak I've just put this in a playground and it works for me.