Get width of a view using in SwiftUI

The only available mechanism to get the dimension of a view, that is auto-resized by SwiftUI, is the GeometryReader. The GeometryReader is a proxy view that returns the dimensions of the container in which your view gets rendered. struct SomeView: View { @State var size: CGSize = .zero var body: some View { VStack { … Read more

Is there a client-side way to detect X-Frame-Options?

OK, this one is old but still relevant. Fact: When an iframe loads a url which is blocked by a X-Frame-Options the loading time is very short. Hack: So if the onload occurs immediately I know it’s probably a X-Frame-Options issue. Disclaimer: This is probably one of the ‘hackiest’ code I’ve written, so don’t expect … Read more

How to set the activity indicator in the navigation bar?

I add the below piece of code in the view where i wanted the activity indicator in the navigation bar. activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator]; [self navigationItem].rightBarButtonItem = barButton; [activityIndicator startAnimating];

Calculating UILabel Text Size

All of the [NSString sizeWithFont…] methods are deprecated in iOS 7. Use this instead. CGRect labelRect = [text boundingRectWithSize:labelSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:14] } context:nil]; Also see https://developer.apple.com/documentation/foundation/nsstring/1619914-sizewithfont. UPDATE – example of boundingRectWithSize output Per your comment I did a simple test. The code and output is below. // code to generate a … Read more

Python Tkinter clearing a frame

https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/universal.html w.winfo_children() Returns a list of all w’s children, in their stacking order from lowest (bottom) to highest (top). for widget in frame.winfo_children(): widget.destroy() Will destroy all the widget in your frame. No need for a second frame.

JsPDF – Not allowed to navigate top frame to data URL

This works well now that chrome has removed top frame navigation. Only downloading the pdf in chrome gives problem. Download works in well in firefox tho. var string = doc.output(‘datauristring’); var iframe = “<iframe width=”100%” height=”100%” src=”” + string + “”></iframe>” var x = window.open(); x.document.open(); x.document.write(iframe); x.document.close();

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)