http://www.phy.mtu.edu/~suits/notefreqs.html
- Frequency: Hz
- Wavelength: cm
Based on A4 = 440Hz (equal-tempered scale)
| import Cocoa | |
| open class ScrollingTextView: NSView { | |
| // MARK: - Open variables | |
| /// Text to scroll | |
| open var text: NSString? | |
| /// Font for scrolling text | |
| open var font: NSFont? |
| class RSVerticallyCenteredTextFieldCell: NSTextFieldCell { | |
| var mIsEditingOrSelecting:Bool = false | |
| override func drawingRect(forBounds theRect: NSRect) -> NSRect { | |
| //Get the parent's idea of where we should draw | |
| var newRect:NSRect = super.drawingRect(forBounds: theRect) | |
| // When the text field is being edited or selected, we have to turn off the magic because it screws up | |
| // the configuration of the field editor. We sneak around this by intercepting selectWithFrame and editWithFrame and sneaking a | |
| // reduced, centered rect in at the last minute. |
| // Makes the text in an NSTextFieldCell vertically centered. Works with single line, non-editable cells. | |
| // Maybe doesn't work with others. | |
| // Stolen from this stackoverflow question: | |
| // http://stackoverflow.com/questions/1235219/is-there-a-right-way-to-have-nstextfieldcell-draw-vertically-centered-text | |
| import Cocoa | |
| class VerticallyCenteredTextFieldCell: NSTextFieldCell { | |
| override func titleRect(forBounds rect: NSRect) -> NSRect { |
| /// Remove all annotation from mapView (MapBox) | |
| func removeAllAnnotations() { | |
| guard let annotations = mapView.annotations else { return print("Annotations Error") } | |
| if annotations.count != 0 { | |
| for annotation in annotations { | |
| mapView.removeAnnotation(annotation) | |
| } |
http://www.phy.mtu.edu/~suits/notefreqs.html
Based on A4 = 440Hz (equal-tempered scale)
| #import <Foundation/Foundation.h> | |
| // clang -g -Wall -fobjc-arc -framework Foundation -o serial serial.m | |
| static id makePlistObjects (void) { | |
| NSMutableDictionary *top = [NSMutableDictionary dictionary]; | |
| [top setObject: @"Hi I'm a string" forKey: @"string"]; | |
| [top setObject: [NSNumber numberWithInt: 23] forKey: @"number"]; |
| - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section | |
| { | |
| float width = tableView.bounds.size.width; | |
| int fontSize = 18; | |
| int padding = 10; | |
| UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, fontSize)]; | |
| view.backgroundColor = [UIColor colorWithWhite:0 alpha:0]; | |
| view.userInteractionEnabled = YES; | |
| view.tag = section; |