Class: Symbol
- Defined in:
- lib/sugarcube/symbol.rb,
lib/sugarcube/defaults.rb,
lib/sugarcube/symbol/symbol_uicolor.rb
Overview
Adds some UI classes to the Symbol class. These methods are prefixed with ui
to make their intent clear, and to provide a little bit of "namespacing"
# alignment
:left.uialignment => UITextAlignmentLeft
# uicolors
:black.uicolor => UIColor.blackColor
:darkturquoise.uicolor => UIColor.blackColor
# fonts
:system.uifont => UIFont.systemFontOfSize(UIFont.systemFontSize)
:label.uifont => UIFont.systemFontOfSize(UIFont.labelFontSize)
You can extend the defaults by adding entries:
Symbol.css_colors[:my_color] = 0x123456
Symbol.font_sizes[:big] = 40
:my_color.uicolor => UIColor
:big.uifont => UIFont
Class Attribute Summary collapse
-
.activityindicator_styles ⇒ Object
Returns the value of attribute activityindicator_styles.
-
.autoresizemasks ⇒ Object
Returns the value of attribute autoresizemasks.
-
.barbuttomitems ⇒ Object
Returns the value of attribute barbuttomitems.
-
.barmetrics ⇒ Object
Returns the value of attribute barmetrics.
-
.baselineadjustments ⇒ Object
Returns the value of attribute baselineadjustments.
-
.border_types ⇒ Object
Returns the value of attribute border_types.
-
.buttontypes ⇒ Object
Returns the value of attribute buttontypes.
-
.ca_timingfunctions ⇒ Object
Returns the value of attribute ca_timingfunctions.
-
.content_modes ⇒ Object
Returns the value of attribute content_modes.
-
.control_events ⇒ Object
Returns the value of attribute control_events.
-
.control_states ⇒ Object
Returns the value of attribute control_states.
-
.css_colors ⇒ Object
Returns the value of attribute css_colors.
-
.date_styles ⇒ Object
Returns the value of attribute date_styles.
-
.datepicker_modes ⇒ Object
Returns the value of attribute datepicker_modes.
-
.device_orientations ⇒ Object
Returns the value of attribute device_orientations.
-
.devices ⇒ Object
Returns the value of attribute devices.
-
.font_sizes ⇒ Object
Returns the value of attribute font_sizes.
-
.gesture_recognizer_states ⇒ Object
Returns the value of attribute gesture_recognizer_states.
-
.image_cameradevice ⇒ Object
Returns the value of attribute image_cameradevice.
-
.image_capturemode ⇒ Object
Returns the value of attribute image_capturemode.
-
.image_quality ⇒ Object
Returns the value of attribute image_quality.
-
.image_sourcetypes ⇒ Object
Returns the value of attribute image_sourcetypes.
-
.keyboardtypes ⇒ Object
Returns the value of attribute keyboardtypes.
-
.linebreakmodes ⇒ Object
Returns the value of attribute linebreakmodes.
-
.orientations ⇒ Object
Returns the value of attribute orientations.
-
.returnkeys ⇒ Object
Returns the value of attribute returnkeys.
-
.segmented_styles ⇒ Object
Returns the value of attribute segmented_styles.
-
.statusbar_styles ⇒ Object
Returns the value of attribute statusbar_styles.
-
.system_fonts ⇒ Object
Returns the value of attribute system_fonts.
-
.tableview_cellaccessorytype ⇒ Object
Returns the value of attribute tableview_cellaccessorytype.
-
.tableview_cellselectionstyle ⇒ Object
Returns the value of attribute tableview_cellselectionstyle.
-
.tableview_cellseparatorstyle ⇒ Object
Returns the value of attribute tableview_cellseparatorstyle.
-
.tableview_cellstyles ⇒ Object
Returns the value of attribute tableview_cellstyles.
-
.tableview_rowanimation ⇒ Object
Returns the value of attribute tableview_rowanimation.
-
.tableview_styles ⇒ Object
Returns the value of attribute tableview_styles.
-
.textalignments ⇒ Object
Returns the value of attribute textalignments.
-
.uicolors ⇒ Object
Returns the value of attribute uicolors.
Instance Method Summary collapse
- #catimingfunction ⇒ Object (also: #catiming)
- #get_default ⇒ Object
- #get_default_or(default) ⇒ Object
- #nsdatestyle ⇒ Object (also: #nsdateformatterstyle)
- #remove_default ⇒ Object
- #set_default(val) ⇒ Object
- #uiactivityindicatorstyle ⇒ Object (also: #uiactivityindicatorviewstyle)
- #uiautoresizemask ⇒ Object (also: #uiviewautoresizing, #uiautoresizingmask, #uiautoresize)
- #uibarbuttonitem ⇒ Object
- #uibarmetrics ⇒ Object
- #uibaselineadjustment ⇒ Object (also: #uibaseline)
- #uibordertype ⇒ Object (also: #uiborderstyle)
- #uibuttontype ⇒ Object
- #uicolor(alpha = nil) ⇒ Object
- #uicontentmode ⇒ Object (also: #uiviewcontentmode)
- #uicontrolevent ⇒ Object
- #uicontrolstate ⇒ Object (also: #uistate)
- #uidatepickermode ⇒ Object
- #uidevice ⇒ Object
- #uideviceorientation ⇒ Object
- #uifont(size = UIFont.systemFontSize) ⇒ Object
- #uifontsize ⇒ Object
- #uigesturerecognizerstate ⇒ Object (also: #uigesturestate)
- #uiimagecamera ⇒ Object (also: #uiimagecameradevice, #uiimagedevice)
- #uiimagecapture ⇒ Object (also: #uiimagecapturemode)
- #uiimagequality ⇒ Object (also: #uiimagequalitytype)
- #uiimagesource ⇒ Object (also: #uiimagesourcetype)
- #uiinterfaceorientation ⇒ Object (also: #uiorientation)
- #uikeyboardtype ⇒ Object
- #uilinebreakmode ⇒ Object
- #uireturnkey ⇒ Object
- #uisegmentedstyle ⇒ Object (also: #uisegmentedcontrolstyle)
- #uistatusbarstyle ⇒ Object
- #uitablecellaccessory ⇒ Object (also: #uitableviewcellaccessorytype)
- #uitablecellselectionstyle ⇒ Object (also: #uitableviewcellselectionstyle)
- #uitablecellseparatorstyle ⇒ Object
- #uitablecellstyle ⇒ Object (also: #uitableviewcellstyle)
- #uitablerowanimation ⇒ Object (also: #uitableviewrowanimation)
- #uitablestyle ⇒ Object (also: #uitableviewstyle)
- #uitextalignment ⇒ Object (also: #uialignment)
Class Attribute Details
.activityindicator_styles ⇒ Object
Returns the value of attribute activityindicator_styles.
48 49 50 |
# File 'lib/sugarcube/symbol.rb', line 48 def @activityindicator_styles end |
.autoresizemasks ⇒ Object
Returns the value of attribute autoresizemasks.
35 36 37 |
# File 'lib/sugarcube/symbol.rb', line 35 def autoresizemasks @autoresizemasks end |
.barbuttomitems ⇒ Object
Returns the value of attribute barbuttomitems.
33 34 35 |
# File 'lib/sugarcube/symbol.rb', line 33 def @barbuttomitems end |
.barmetrics ⇒ Object
Returns the value of attribute barmetrics.
32 33 34 |
# File 'lib/sugarcube/symbol.rb', line 32 def @barmetrics end |
.baselineadjustments ⇒ Object
Returns the value of attribute baselineadjustments.
39 40 41 |
# File 'lib/sugarcube/symbol.rb', line 39 def baselineadjustments @baselineadjustments end |
.border_types ⇒ Object
Returns the value of attribute border_types.
45 46 47 |
# File 'lib/sugarcube/symbol.rb', line 45 def border_types @border_types end |
.buttontypes ⇒ Object
Returns the value of attribute buttontypes.
44 45 46 |
# File 'lib/sugarcube/symbol.rb', line 44 def @buttontypes end |
.ca_timingfunctions ⇒ Object
Returns the value of attribute ca_timingfunctions.
65 66 67 |
# File 'lib/sugarcube/symbol.rb', line 65 def ca_timingfunctions @ca_timingfunctions end |
.content_modes ⇒ Object
Returns the value of attribute content_modes.
51 52 53 |
# File 'lib/sugarcube/symbol.rb', line 51 def content_modes @content_modes end |
.control_events ⇒ Object
Returns the value of attribute control_events.
47 48 49 |
# File 'lib/sugarcube/symbol.rb', line 47 def control_events @control_events end |
.control_states ⇒ Object
Returns the value of attribute control_states.
46 47 48 |
# File 'lib/sugarcube/symbol.rb', line 46 def control_states @control_states end |
.css_colors ⇒ Object
Returns the value of attribute css_colors.
4 5 6 |
# File 'lib/sugarcube/symbol/symbol_uicolor.rb', line 4 def css_colors @css_colors end |
.date_styles ⇒ Object
Returns the value of attribute date_styles.
42 43 44 |
# File 'lib/sugarcube/symbol.rb', line 42 def date_styles @date_styles end |
.datepicker_modes ⇒ Object
Returns the value of attribute datepicker_modes.
50 51 52 |
# File 'lib/sugarcube/symbol.rb', line 50 def datepicker_modes @datepicker_modes end |
.device_orientations ⇒ Object
Returns the value of attribute device_orientations.
28 29 30 |
# File 'lib/sugarcube/symbol.rb', line 28 def device_orientations @device_orientations end |
.devices ⇒ Object
Returns the value of attribute devices.
27 28 29 |
# File 'lib/sugarcube/symbol.rb', line 27 def devices @devices end |
.font_sizes ⇒ Object
Returns the value of attribute font_sizes.
41 42 43 |
# File 'lib/sugarcube/symbol.rb', line 41 def font_sizes @font_sizes end |
.gesture_recognizer_states ⇒ Object
Returns the value of attribute gesture_recognizer_states.
67 68 69 |
# File 'lib/sugarcube/symbol.rb', line 67 def gesture_recognizer_states @gesture_recognizer_states end |
.image_cameradevice ⇒ Object
Returns the value of attribute image_cameradevice.
62 63 64 |
# File 'lib/sugarcube/symbol.rb', line 62 def image_cameradevice @image_cameradevice end |
.image_capturemode ⇒ Object
Returns the value of attribute image_capturemode.
61 62 63 |
# File 'lib/sugarcube/symbol.rb', line 61 def image_capturemode @image_capturemode end |
.image_quality ⇒ Object
Returns the value of attribute image_quality.
63 64 65 |
# File 'lib/sugarcube/symbol.rb', line 63 def image_quality @image_quality end |
.image_sourcetypes ⇒ Object
Returns the value of attribute image_sourcetypes.
60 61 62 |
# File 'lib/sugarcube/symbol.rb', line 60 def image_sourcetypes @image_sourcetypes end |
.keyboardtypes ⇒ Object
Returns the value of attribute keyboardtypes.
34 35 36 |
# File 'lib/sugarcube/symbol.rb', line 34 def keyboardtypes @keyboardtypes end |
.linebreakmodes ⇒ Object
Returns the value of attribute linebreakmodes.
38 39 40 |
# File 'lib/sugarcube/symbol.rb', line 38 def linebreakmodes @linebreakmodes end |
.orientations ⇒ Object
Returns the value of attribute orientations.
29 30 31 |
# File 'lib/sugarcube/symbol.rb', line 29 def orientations @orientations end |
.returnkeys ⇒ Object
Returns the value of attribute returnkeys.
30 31 32 |
# File 'lib/sugarcube/symbol.rb', line 30 def returnkeys @returnkeys end |
.segmented_styles ⇒ Object
Returns the value of attribute segmented_styles.
49 50 51 |
# File 'lib/sugarcube/symbol.rb', line 49 def segmented_styles @segmented_styles end |
.statusbar_styles ⇒ Object
Returns the value of attribute statusbar_styles.
31 32 33 |
# File 'lib/sugarcube/symbol.rb', line 31 def @statusbar_styles end |
.system_fonts ⇒ Object
Returns the value of attribute system_fonts.
40 41 42 |
# File 'lib/sugarcube/symbol.rb', line 40 def system_fonts @system_fonts end |
.tableview_cellaccessorytype ⇒ Object
Returns the value of attribute tableview_cellaccessorytype.
56 57 58 |
# File 'lib/sugarcube/symbol.rb', line 56 def tableview_cellaccessorytype @tableview_cellaccessorytype end |
.tableview_cellselectionstyle ⇒ Object
Returns the value of attribute tableview_cellselectionstyle.
57 58 59 |
# File 'lib/sugarcube/symbol.rb', line 57 def tableview_cellselectionstyle @tableview_cellselectionstyle end |
.tableview_cellseparatorstyle ⇒ Object
Returns the value of attribute tableview_cellseparatorstyle.
58 59 60 |
# File 'lib/sugarcube/symbol.rb', line 58 def tableview_cellseparatorstyle @tableview_cellseparatorstyle end |
.tableview_cellstyles ⇒ Object
Returns the value of attribute tableview_cellstyles.
55 56 57 |
# File 'lib/sugarcube/symbol.rb', line 55 def tableview_cellstyles @tableview_cellstyles end |
.tableview_rowanimation ⇒ Object
Returns the value of attribute tableview_rowanimation.
54 55 56 |
# File 'lib/sugarcube/symbol.rb', line 54 def tableview_rowanimation @tableview_rowanimation end |
.tableview_styles ⇒ Object
Returns the value of attribute tableview_styles.
53 54 55 |
# File 'lib/sugarcube/symbol.rb', line 53 def tableview_styles @tableview_styles end |
.textalignments ⇒ Object
Returns the value of attribute textalignments.
37 38 39 |
# File 'lib/sugarcube/symbol.rb', line 37 def textalignments @textalignments end |
.uicolors ⇒ Object
Returns the value of attribute uicolors.
3 4 5 |
# File 'lib/sugarcube/symbol/symbol_uicolor.rb', line 3 def uicolors @uicolors end |
Instance Method Details
#catimingfunction ⇒ Object Also known as: catiming
581 582 583 |
# File 'lib/sugarcube/symbol.rb', line 581 def catimingfunction look_in(Symbol.ca_timingfunctions) end |
#get_default ⇒ Object
3 4 5 |
# File 'lib/sugarcube/defaults.rb', line 3 def get_default to_s.get_default end |
#get_default_or(default) ⇒ Object
7 8 9 |
# File 'lib/sugarcube/defaults.rb', line 7 def get_default_or(default) to_s.get_default_or(default) end |
#nsdatestyle ⇒ Object Also known as: nsdateformatterstyle
614 615 616 |
# File 'lib/sugarcube/symbol.rb', line 614 def nsdatestyle look_in(Symbol.date_styles) end |
#remove_default ⇒ Object
15 16 17 |
# File 'lib/sugarcube/defaults.rb', line 15 def remove_default to_s.remove_default end |
#set_default(val) ⇒ Object
11 12 13 |
# File 'lib/sugarcube/defaults.rb', line 11 def set_default val to_s.set_default val end |
#uiactivityindicatorstyle ⇒ Object Also known as: uiactivityindicatorviewstyle
487 488 489 |
# File 'lib/sugarcube/symbol.rb', line 487 def look_in(Symbol.) end |
#uiautoresizemask ⇒ Object Also known as: uiviewautoresizing, uiautoresizingmask, uiautoresize
553 554 555 |
# File 'lib/sugarcube/symbol.rb', line 553 def uiautoresizemask look_in(Symbol.autoresizemasks) end |
#uibarbuttonitem ⇒ Object
545 546 547 |
# File 'lib/sugarcube/symbol.rb', line 545 def look_in(Symbol.) end |
#uibarmetrics ⇒ Object
541 542 543 |
# File 'lib/sugarcube/symbol.rb', line 541 def look_in(Symbol.) end |
#uibaselineadjustment ⇒ Object Also known as: uibaseline
453 454 455 |
# File 'lib/sugarcube/symbol.rb', line 453 def uibaselineadjustment look_in(Symbol.baselineadjustments) end |
#uibordertype ⇒ Object Also known as: uiborderstyle
468 469 470 |
# File 'lib/sugarcube/symbol.rb', line 468 def uibordertype look_in(Symbol.border_types) end |
#uibuttontype ⇒ Object
464 465 466 |
# File 'lib/sugarcube/symbol.rb', line 464 def look_in(Symbol.) end |
#uicolor(alpha = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sugarcube/symbol/symbol_uicolor.rb', line 7 def uicolor(alpha=nil) if Symbol.uicolors.has_key? self # iOS colors color = UIColor.send(look_in(Symbol.uicolors)) if not alpha.nil? color = color.colorWithAlphaComponent(alpha.to_f) end else # css colors color = look_in(Symbol.css_colors).uicolor(alpha) end color end |
#uicontentmode ⇒ Object Also known as: uiviewcontentmode
503 504 505 |
# File 'lib/sugarcube/symbol.rb', line 503 def uicontentmode look_in(Symbol.content_modes) end |
#uicontrolevent ⇒ Object
479 480 481 |
# File 'lib/sugarcube/symbol.rb', line 479 def uicontrolevent look_in(Symbol.control_events) end |
#uicontrolstate ⇒ Object Also known as: uistate
473 474 475 |
# File 'lib/sugarcube/symbol.rb', line 473 def uicontrolstate look_in(Symbol.control_states) end |
#uidatepickermode ⇒ Object
499 500 501 |
# File 'lib/sugarcube/symbol.rb', line 499 def uidatepickermode look_in(Symbol.datepicker_modes) end |
#uidevice ⇒ Object
435 436 437 |
# File 'lib/sugarcube/symbol.rb', line 435 def uidevice look_in(Symbol.devices) end |
#uideviceorientation ⇒ Object
439 440 441 |
# File 'lib/sugarcube/symbol.rb', line 439 def uideviceorientation look_in(Symbol.device_orientations) end |
#uifont(size = UIFont.systemFontSize) ⇒ Object
591 592 593 594 595 596 597 598 599 600 601 602 603 604 |
# File 'lib/sugarcube/symbol.rb', line 591 def uifont(size=UIFont.systemFontSize) # system fonts if Symbol.system_fonts.has_key? self font = look_in(Symbol.system_fonts) if size.is_a? Symbol size = Symbol.font_sizes.fetch(size).uifontsize end font = UIFont.send(font, size) else size = look_in(font_sizes).uifontsize font = UIFont.systemFontOfSize(size) end font end |
#uifontsize ⇒ Object
606 607 608 609 610 611 612 |
# File 'lib/sugarcube/symbol.rb', line 606 def uifontsize size = look_in(Symbol.system_fonts) if size.is_a? Symbol return UIFont.send(Symbol.font_sizes[self]) end return size.to_f end |
#uigesturerecognizerstate ⇒ Object Also known as: uigesturestate
586 587 588 |
# File 'lib/sugarcube/symbol.rb', line 586 def uigesturerecognizerstate look_in(Symbol.gesture_recognizer_states) end |
#uiimagecamera ⇒ Object Also known as: uiimagecameradevice, uiimagedevice
570 571 572 |
# File 'lib/sugarcube/symbol.rb', line 570 def uiimagecamera look_in(Symbol.image_cameradevice) end |
#uiimagecapture ⇒ Object Also known as: uiimagecapturemode
565 566 567 |
# File 'lib/sugarcube/symbol.rb', line 565 def uiimagecapture look_in(Symbol.image_capturemode) end |
#uiimagequality ⇒ Object Also known as: uiimagequalitytype
576 577 578 |
# File 'lib/sugarcube/symbol.rb', line 576 def uiimagequality look_in(Symbol.image_quality) end |
#uiimagesource ⇒ Object Also known as: uiimagesourcetype
560 561 562 |
# File 'lib/sugarcube/symbol.rb', line 560 def uiimagesource look_in(Symbol.image_sourcetypes) end |
#uiinterfaceorientation ⇒ Object Also known as: uiorientation
459 460 461 |
# File 'lib/sugarcube/symbol.rb', line 459 def uiinterfaceorientation look_in(Symbol.orientations) end |
#uikeyboardtype ⇒ Object
549 550 551 |
# File 'lib/sugarcube/symbol.rb', line 549 def uikeyboardtype look_in(Symbol.keyboardtypes) end |
#uilinebreakmode ⇒ Object
449 450 451 |
# File 'lib/sugarcube/symbol.rb', line 449 def uilinebreakmode look_in(Symbol.linebreakmodes) end |
#uireturnkey ⇒ Object
483 484 485 |
# File 'lib/sugarcube/symbol.rb', line 483 def uireturnkey look_in(Symbol.returnkeys) end |
#uisegmentedstyle ⇒ Object Also known as: uisegmentedcontrolstyle
493 494 495 |
# File 'lib/sugarcube/symbol.rb', line 493 def uisegmentedstyle look_in(Symbol.segmented_styles) end |
#uistatusbarstyle ⇒ Object
537 538 539 |
# File 'lib/sugarcube/symbol.rb', line 537 def look_in(Symbol.) end |
#uitablecellaccessory ⇒ Object Also known as: uitableviewcellaccessorytype
523 524 525 |
# File 'lib/sugarcube/symbol.rb', line 523 def uitablecellaccessory look_in(Symbol.tableview_cellaccessorytype) end |
#uitablecellselectionstyle ⇒ Object Also known as: uitableviewcellselectionstyle
528 529 530 |
# File 'lib/sugarcube/symbol.rb', line 528 def uitablecellselectionstyle look_in(Symbol.tableview_cellselectionstyle) end |
#uitablecellseparatorstyle ⇒ Object
533 534 535 |
# File 'lib/sugarcube/symbol.rb', line 533 def uitablecellseparatorstyle look_in(Symbol.tableview_cellseparatorstyle) end |
#uitablecellstyle ⇒ Object Also known as: uitableviewcellstyle
518 519 520 |
# File 'lib/sugarcube/symbol.rb', line 518 def uitablecellstyle look_in(Symbol.tableview_cellstyles) end |
#uitablerowanimation ⇒ Object Also known as: uitableviewrowanimation
513 514 515 |
# File 'lib/sugarcube/symbol.rb', line 513 def uitablerowanimation look_in(Symbol.tableview_rowanimation) end |
#uitablestyle ⇒ Object Also known as: uitableviewstyle
508 509 510 |
# File 'lib/sugarcube/symbol.rb', line 508 def uitablestyle look_in(Symbol.tableview_styles) end |
#uitextalignment ⇒ Object Also known as: uialignment
443 444 445 |
# File 'lib/sugarcube/symbol.rb', line 443 def uitextalignment look_in(Symbol.textalignments) end |